@aurora-it/fastify-kit
v2.4.5
Published
A full-stack Fastify starter kit with authentication, Prisma ORM, and Vue.js frontend. Use the CLI to scaffold a complete project in seconds.
Maintainers
Readme
fastify-kit
A full-stack Fastify starter kit with authentication, Prisma ORM, and Vue.js frontend.
Features
- Fastify backend with plugin architecture, DI, and middleware support
- Vue 3 frontend with Vite, Tailwind CSS, and TypeScript
- Prisma ORM with SQLite (easily swappable to PostgreSQL / MySQL)
- Authentication — JWT, sessions, OAuth, MFA (TOTP), WebAuthn
- Authorization — role-based guards, IP whitelisting, API keys
- Payment — Stripe integration with webhook handling and ledger
- Queue — Bull + Redis job processing with monitoring UI
- Testing — Vitest with >80% coverage target
Requirements
- Node.js >= 18
- pnpm (or npm / yarn)
Quick Start
# Install the CLI globally
npm install -g fastify-kit
# Scaffold a new project
mkdir my-app && cd my-app
fkit setup
# Install dependencies
pnpm install
# Configure environment
cp .env.example .env
# Edit .env with your settings
# Run database migrations
pnpm db:migrate
# Start development server
pnpm devCLI Commands
| Command | Description |
|---|---|
| fkit setup | Scaffold a new project or update an existing one |
| fkit create:app <name> | Create a new frontend Vue app |
| fkit create:plugin <name> | Create a new backend Fastify plugin |
| fkit create:route <name> | Create a new API route |
| fkit create:service <name> | Create a new service |
| fkit create:guard <name> | Create a new route guard |
| fkit list:apps | List all frontend apps |
| fkit list:routes | List all backend routes |
| fkit help [command] | Show help |
fkit setup Options
fkit setup [options]
Options:
--backup Create a timestamped backup before making changes
--no-backup Skip the backup prompt
--force Overwrite all differing files without prompting
--dry-run Preview changes without writing any files
--log Write a fkit-setup.log file with all decisionssetup.json Config File
Place a setup.json in your project root to control which files the setup command manages:
{
"include": ["backend/**", "frontend/**"],
"exclude": ["backend/config/payment.config.js"],
"backup": true,
"log": true
}| Field | Type | Description |
|---|---|---|
| include | string[] | Glob patterns of paths to manage (default: all) |
| exclude | string[] | Glob patterns of paths to skip |
| backup | boolean | Always create a backup (skips the prompt) |
| log | boolean | Always write fkit-setup.log |
Project Structure
After running fkit setup, your project will have the following structure:
my-app/
├── backend/ # Fastify server
│ ├── auth/ # Authentication strategies & middleware
│ ├── core/ # DI container, errors, utilities
│ ├── guards/ # Route guards
│ ├── interceptors/ # Request/response interceptors
│ ├── middleware/ # Fastify middleware
│ ├── payment/ # Stripe integration
│ ├── plugins/ # Fastify plugins
│ ├── routes/ # API routes
│ ├── services/ # Business logic services
│ └── views/ # Nunjucks templates
├── frontend/ # Vue 3 + Vite apps
│ ├── apps/ # Individual Vue applications
│ ├── libs/ # Shared Vue component libraries
│ └── shared/ # Shared utilities & composables
├── cli/ # fastify-kit CLI source
├── prisma/
│ ├── schema.prisma # Database schema
│ ├── seed.js # Database seeder
│ └── setup.sqlite # Package setup database
├── .env.example # Environment variable template
├── package.json # Project dependencies
└── README.md # Project documentationEnvironment Variables
Copy .env.example to .env and configure:
# Database
DATABASE_URL="file:./prisma/dev.db"
# Application
PORT=3000
HOST=localhost
NODE_ENV=development
# Session / Cookie
SESSION_SECRET=your-secret-here
COOKIE_SECRET=your-cookie-secret-here
# OAuth (optional)
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
# Stripe (optional)
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
# Redis (for queues, optional)
REDIS_URL=redis://localhost:6379Documentation
Full documentation is available in the docs/ directory after running fkit setup:
License
MIT © MJ
