https://github.com/rudrodip/titan
Next.js 15 fullstack template with better-auth for authentication and drizzle-orm as the orm
https://github.com/rudrodip/titan
better-auth drizzle-orm neondb nextjs nextjs15 shadcn-ui tailwindcss-v4
Last synced: 9 days ago
JSON representation
Next.js 15 fullstack template with better-auth for authentication and drizzle-orm as the orm
- Host: GitHub
- URL: https://github.com/rudrodip/titan
- Owner: rudrodip
- License: mit
- Created: 2025-05-14T19:33:04.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-05-26T11:33:48.000Z (26 days ago)
- Last Synced: 2025-06-04T19:40:05.249Z (17 days ago)
- Topics: better-auth, drizzle-orm, neondb, nextjs, nextjs15, shadcn-ui, tailwindcss-v4
- Language: TypeScript
- Homepage: https://titan.rdsx.dev
- Size: 455 KB
- Stars: 250
- Watchers: 1
- Forks: 25
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Titan
Next.js 15 fullstack template with better-auth for authentication and drizzle-orm as the ORM.

> [!WARNING]
> This project uses Next.js 15-canary to support node runtime on middleware. This is not yet supported in stable version.## Tech Stack
- Full-stack framework: Next.js 15-canary
- UI: Tailwind CSS v4
- Component library: Shadcn UI
- Authentication: better-auth
- Database: postgres
- ORM: drizzle-orm## Features
- Authentication
- Social login
- Github
- Discord
- Database
- Postgres (Neon)
- ORM: drizzle-orm
- Next.js API, server actions, and middleware## Getting Started
Clone the repository
```bash
git clone https://github.com/rudrodip/titan.git
```Install dependencies
```bash
bun install
```Create environment file
```bash
cp .env.example .env
```Provide environment variables in `.env` file
- `BETTER_AUTH_SECRET`: Secret key for Better Auth authentication generate one [here](https://www.better-auth.com/docs/installation#set-environment-variables)
- `BETTER_AUTH_URL`: Better Auth URL (e.g., `http://localhost:3000`)
- `DATABASE_URL`: PostgreSQL connection string provided from Neon (e.g., `postgresql://username:password@neon:5432/titan`)Generate database schema
```bash
bun run db:generate
```Migrate database
```bash
bun run db:migrate
```Run the development server
```bash
bun dev
```Open the browser and navigate to `http://localhost:3000`
## Using a Local Database
Have Docker installed on your system. Before running the db:generate command from Getting Started, run the following command in the project directory to start a local database:
```bash
docker-compose up -d
```Use the following environment variables in `.env` file:
- `DATABASE_URL`: `postgres://postgres:postgres@localhost:5432/titan`Add the `pg` and `@types/pg` dependencies to your project:
```bash
bun add pg
bun add -D @types/pg
```Then, change the `/src/lib/db/index.ts` file to use the `drizzle-orm/node-postgres` and `pg` package instead of `@neondatabase/serverless`:
```typescript
import * as schema from "@/lib/db/schema";
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";const sql = new Pool({
connectionString: process.env.DATABASE_URL,
});
export const db = drizzle(sql, { schema });
```Continue steps from Getting Started e.g. generating the database schema, applying migrations, and running the dev server.
Open the browser and navigate to `http://localhost:3000`