A modern, high-performance Full Stack monorepo template designed for scalability and developer experience.
- Monorepo Manager: Nx (Caching, Task Orchestration)
- Package Manager: pnpm
- Backend: ElysiaJS (running on Bun)
- Frontend: Nuxt 4 + Nuxt UI
- Database: PostgreSQL + Drizzle ORM
- Authentication: Better Auth (v1.4+)
This project implements a complete, production-ready authentication system using Better Auth with the following plugins and features enabled:
- Email & Password: Traditional sign-up/sign-in flow.
- OAuth Social Login: Google & GitHub integration.
- Multi-Session Management: Support for multiple active accounts in the same browser with instant switching.
- Two-Factor Authentication (2FA): TOTP (Authenticator App) & Backup Codes with Trusted Device support.
- Passkeys (WebAuthn): Biometric login (Fingerprint/FaceID) support.
- Email Verification: Secure verification flow for new accounts.
- Password Reset: Secure forgot password flow via email.
- Account Deletion: "Danger Zone" to permanently delete accounts (with email confirmation for OAuth users).
- OpenAPI: Auto-generated API documentation for auth routes.
- Username Support: Login with email or username.
- Node.js: v20 or higher.
- Bun: Latest version (required for Elysia backend).
- pnpm:
npm install -g pnpm - PostgreSQL: A running instance (local or cloud).
-
Clone the repository:
git clone https://github.com/TheViberCoder/elysia-nuxt.git cd elysia-nuxt -
Install dependencies:
pnpm install
-
Setup Environment Variables: Copy the example file to create your local configuration.
cp .env.example .env cp apps/backend/.env.example apps/backend/.env cp apps/frontend/.env.example apps/frontend/.env
Note: Update
.envwith your real Database URL (DATABASE_URL), OAuth credentials (GOOGLE_CLIENT_ID,GITHUB_CLIENT_ID), and SMTP settings for email sending.
This project uses Drizzle ORM. We have automated scripts to sync Better Auth schemas with your database.
-
Generate Auth Schema & Migrations: This command generates the Better Auth schema, moves it to the correct folder, and creates the SQL migration files.
nx run backend:db:generate
-
Apply Migrations: Push the changes to your PostgreSQL database.
nx run backend:db:migrate
-
(Optional) Generate Auth Secret: If you need a new secret for
BETTER_AUTH_SECRET:nx run backend:auth:secret
Start the development server. Nx will run both the Backend (port 4243) and Frontend (port 4242) in parallel.
pnpm devOr using Nx directly:
nx run-many -t devTo build all applications optimized for production:
pnpm buildThe output will be available in:
- Frontend:
apps/frontend/.output - Backend:
apps/backend/dist
- Add Roles & Permissions
- Add Organization | Teams support