skorphil / monorepo-auth-starter

Authentication in monorepo starter pack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lucia authentication in monorepo starter pack

Opionated minimal implementation of shared auth between multiple packages. Read more in article – Authentication in monorepo(NextJs, Astro) with Lucia and MongoDB

Project overview

  • mysite.com – landing page built with Astro Publicly available Provides login/signup page Redirects authenticated users to app.mysite.com
  • app.mysite.com – web application built with NextJs (app Router) Available only for authenticated users Provides sign-out feature Redirects unauthenticated users to mysite.com

Stack

  • Astro
  • NextJs (app router)
  • Lucia-auth
  • Mongoose
  • TurboRepo
  • npm
  • dotenv

Monorepo structure

flowchart TB
auth-utils & web -->
db-utils
web & landing --->
auth-utils
Loading
  • db-utils - provide simple db methods to work with MongoDb. CreateUser, GetUser. These methods are used by auth-utils.
  • auth-utils - provide methods to create users and user sessions. Used by web and landing
  • web - web application, accessible only for authenticated users. Provides log-out function
  • landing - public landing page. Provides logout and login form. Inaccessible for authenticated users

About

Authentication in monorepo starter pack


Languages

Language:TypeScript 41.7%Language:CSS 26.6%Language:JavaScript 17.9%Language:Astro 13.0%Language:Handlebars 0.8%