A simple starter template for building APIs with Fastify, Drizzle and TypeScript using Node.js 22+/24+.
- Node.js 22.0.0 or higher
- npm
git clone https://github.com/lfrallon/fastify-drizzle-app.git
cd fastify-drizzle-app
npm installStart the development server with hot reload:
npm run devThe server will automatically restart when you change files.
Start the production server:
npm run startnpm run typecheck # Check for TypeScript errors
npm run format # Format code with Prettier
npm run db:studio # Web interface for drizzle database├── drizzle.config.ts
├── fastify-database-erd
├── package.json
├── package-lock.json
├── README.md
├── src
│ ├── db
│ │ └── index.ts
│ ├── drizzle
│ │ ├── migrations
│ │ │ ├── 0000_flimsy_dragon_man.sql
│ │ │ ├── 0001_stale_manta.sql
│ │ │ ├── 0002_watery_young_avengers.sql
│ │ │ └── meta
│ │ │ ├── 0000_snapshot.json
│ │ │ ├── 0001_snapshot.json
│ │ │ ├── 0002_snapshot.json
│ │ │ └── _journal.json
│ │ └── schema
│ │ ├── index.ts
│ │ ├── relations.ts
│ │ └── schema.ts
│ ├── index.ts
│ ├── lib
│ │ ├── auth-client.ts
│ │ └── auth.ts
│ ├── plugins
│ ├── routes
│ │ ├── api
│ │ │ └── v1
│ │ │ ├── todos
│ │ │ │ └── index.ts
│ │ │ └── users
│ │ │ └── index.ts
│ │ └── root.ts
│ ├── server.ts
│ └── utils
│ └── pagination.ts
├── static
│ └── index.html
└── tsconfig.json
- Start the dev server:
npm run dev - Visit
http://localhost:3006in your browser - Check
http://localhost:3006/api/v1/userfor the API endpoint - Edit files in
src/to see changes automatically
- ✅ Fastify web framework
- ✅ TypeScript support (no build step needed)
- ✅ Hot reload in development
- ✅ Type checking with
npm run typecheck - ✅ Better Auth for authentication
- ✅ Drizzle for database
- ✅ Support Docker and Docker Compose
MIT