https://github.com/skorphil/monorepo-auth-starter
Authentication in monorepo starter pack
https://github.com/skorphil/monorepo-auth-starter
astrojs authentication lucia-auth mongodb mongoose monorepo nextjs turborepo turborepo-starter
Last synced: 3 months ago
JSON representation
Authentication in monorepo starter pack
- Host: GitHub
- URL: https://github.com/skorphil/monorepo-auth-starter
- Owner: skorphil
- Created: 2024-05-24T09:30:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-06T08:55:38.000Z (over 1 year ago)
- Last Synced: 2025-06-05T16:47:33.467Z (4 months ago)
- Topics: astrojs, authentication, lucia-auth, mongodb, mongoose, monorepo, nextjs, turborepo, turborepo-starter
- Language: TypeScript
- Homepage:
- Size: 242 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://dev.to/skorphil/authentication-in-monoreponextjs-astro-with-lucia-and-mongodb-16d7)## 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
```mermaid
flowchart TB
auth-utils & web -->
db-utils
web & landing --->
auth-utils
```- `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