Introduction

Production-ready SaaS starter kit with authentication, user management, and session tracking

Fastly is a full-stack authentication and user management system built with Next.js 16. It provides everything you need to handle user accounts, sessions, and profiles in production applications.

Features

Tech Stack

CategoryTechnology
FrameworkNext.js 16 (App Router)
LanguageTypeScript
DatabaseMongoDB with Mongoose
AuthenticationJWT with access/refresh tokens
StylingTailwind CSS + shadcn/ui
ValidationZod schemas
File UploadUploadThing
EmailReact Email + Nodemailer

Project Structure

How It Works

User Registration

User submits email and password. The system creates an unverified account and sends a 6-digit OTP to their email.

Email Verification

User enters the OTP code. Once verified, the system creates their profile and generates JWT tokens.

Session Creation

A session record is created with device metadata (browser, OS, IP). The session ID is returned alongside tokens.

Authenticated Requests

All protected endpoints require the access token in the Authorization header and session ID in the X-Session-Id header.

Next Steps

On this page