A modern, full-stack boilerplate for building web applications with Nuxt 4, Prisma, TypeScript, and PostgreSQL. This project includes authentication, CRUD operations, i18n support, and a beautiful UI ready for production.
Created by nuicoder
- π Authentication System - Complete auth flow with JWT tokens (access & refresh)
- π Recipe Management - Full CRUD operations for recipes
- π Internationalization (i18n) - Support for multiple languages (EN, VI)
- π¨ Modern UI - Beautiful, responsive design with custom components
- ποΈ Database - Prisma ORM with PostgreSQL
- π API Routes - RESTful API built with Nuxt server routes
- π§© Reusable Components - Modular and maintainable component architecture
- π― Type Safety - Full TypeScript support
- π± Responsive Design - Mobile-first approach
- π SEO Optimized - Meta tags, OG images, and sitemap
- π Middleware Protection - Route guards for authentication
- β Form Validation - Zod schema validation
- π Modal System - Reusable confirmation modals
- π Language Switcher - Easy language switching
- π State Management - Pinia for global state
- π§ Git Hooks - Husky + Commitlint for conventional commits
- π CI/CD Ready - GitHub Actions workflow included
- Frontend Framework: Nuxt 4
- Language: TypeScript
- Styling: Tailwind CSS + Custom CSS
- Database: PostgreSQL
- ORM: Prisma
- Authentication: JWT (jsonwebtoken + bcrypt)
- i18n: @nuxtjs/i18n
- State Management: Pinia
- Image Optimization: @nuxt/image
- OG Images: nuxt-og-image
- Code Quality: ESLint, Husky, Commitlint
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher)
- Yarn (or npm/pnpm)
- PostgreSQL (v14 or higher)
- Git
git clone https://github.com/sonht113/nuxt-boilerplate-for-starter.git
cd nuxt-boilerplate-for-starteryarn install
# or
npm installCreate a .env file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/recipe_db"
# JWT Secret (change this in production)
JWT_SECRET="your-super-secret-jwt-key-change-in-production"
# Base URL (for i18n)
BASE_URL="http://localhost:3000"Run Prisma migrations to set up your database:
# Generate Prisma Client
npx prisma generate
# Run migrations
npx prisma migrate dev
# (Optional) Seed the database
npx prisma db seedyarn devThe application will be available at http://localhost:3000
nuxt-boilerplate-for-starter/
βββ app/
β βββ app.vue # Root component
β βββ components/
β β βββ common/ # Reusable components
β β β βββ ConfirmModal.vue
β β β βββ LanguageSwitcher.vue
β β βββ layout/ # Layout components
β β βββ header.vue
β β βββ footer.vue
β βββ layouts/
β β βββ default.vue # Default layout
β βββ middleware/
β β βββ auth.global.ts # Global auth middleware
β β βββ guest.ts # Guest middleware
β βββ pages/
β β βββ index.vue # Home page
β β βββ login.vue # Login page
β β βββ register.vue # Register page
β β βββ recipes/
β β βββ index.vue # Recipe list
β β βββ [id].vue # Recipe detail
β β βββ create.vue # Create recipe
β β βββ my.vue # My recipes
β β βββ edit/
β β βββ [id].vue # Edit recipe
β βββ plugins/
β βββ auth-interceptor.ts # Global API interceptor
βββ composables/
β βββ useAuth.ts # Authentication composable
β βββ useRecipe.ts # Single recipe composable
β βββ useRecipes.ts # Recipes list composable
β βββ useRecipeForm.ts # Recipe form composable
β βββ ...
βββ i18n/
β βββ locales/
β βββ en.ts # English translations
β βββ vi.ts # Vietnamese translations
βββ prisma/
β βββ schema.prisma # Database schema
β βββ migrations/ # Database migrations
βββ server/
β βββ api/
β β βββ auth/ # Auth endpoints
β β β βββ login.post.ts
β β β βββ register.post.ts
β β β βββ logout.post.ts
β β β βββ refresh.post.ts
β β β βββ me.get.ts
β β β βββ change-password.post.ts
β β βββ recipes/ # Recipe endpoints
β β βββ index.get.ts
β β βββ index.post.ts
β β βββ [id].get.ts
β β βββ [id].put.ts
β β βββ [id].patch.ts
β β βββ [id].delete.ts
β β βββ my.get.ts
β β βββ categories.get.ts
β β βββ stats.get.ts
β βββ utils/
β βββ auth.ts # Auth utilities
β βββ prisma.ts # Prisma client
βββ .github/
β βββ workflows/
β βββ ci.yml # CI/CD pipeline
βββ .husky/
β βββ commit-msg # Commit message hook
βββ commitlint.config.js # Commitlint configuration
βββ nuxt.config.ts # Nuxt configuration
βββ prisma/schema.prisma # Database schema
βββ tailwind.config.js # Tailwind configuration
βββ tsconfig.json # TypeScript configuration
- Register - Create a new account with email, name, and password
- Login - Authenticate and receive access + refresh tokens
- Protected Routes - Middleware checks authentication status
- Token Refresh - Automatic token refresh on expiration
- Logout - Clear tokens and redirect to login
- Auto Redirect - 401 errors automatically redirect to login
- id, email, name, password (hashed)
- recipes (relation)
- refreshTokens (relation)
- id, title, description, ingredients, instructions
- cookingTime, servings, imageUrl, category, difficulty
- isPublic, authorId (relation to User)
- author (relation)
- id, token, userId (relation to User)
- expiresAt, createdAt
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/logout- Logout userPOST /api/auth/refresh- Refresh access tokenGET /api/auth/me- Get current userPOST /api/auth/change-password- Change password
GET /api/recipes- Get all recipes (with filters)GET /api/recipes/:id- Get recipe by IDPOST /api/recipes- Create new recipe (auth required)PUT /api/recipes/:id- Update recipe (auth required)PATCH /api/recipes/:id- Partial update (auth required)DELETE /api/recipes/:id- Delete recipe (auth required)GET /api/recipes/my- Get user's recipes (auth required)GET /api/recipes/categories- Get recipe categoriesGET /api/recipes/stats- Get recipe statistics
The app supports multiple languages. Add translations in i18n/locales/:
// i18n/locales/en.ts
export default {
welcome: "Welcome",
// ... more translations
};
// i18n/locales/vi.ts
export default {
welcome: "ChΓ o mα»«ng",
// ... more translations
};Use in components:
<template>
<h1>{{ $t("welcome") }}</h1>
</template>Reusable confirmation modal for delete/important actions:
<CommonConfirmModal
v-model="showModal"
title="Delete Recipe"
message="Are you sure?"
type="danger"
@confirm="handleDelete"
/>Language switcher with dropdown:
<CommonLanguageSwitcher /># Development
yarn dev # Start dev server
# Build
yarn build # Build for production
yarn preview # Preview production build
# Database
npx prisma studio # Open Prisma Studio
npx prisma migrate dev # Run migrations
# Code Quality
yarn prepare # Setup Husky hooksThis project uses Conventional Commits:
feat: add new feature
fix: bug fix
docs: documentation changes
style: code style changes
refactor: code refactoring
perf: performance improvements
test: add tests
build: build system changes
ci: CI configuration
chore: other changesSee COMMIT_CONVENTION.md for details.
yarn buildMake sure to set these in your production environment:
DATABASE_URL- Production database URLJWT_SECRET- Strong secret keyBASE_URL- Production domain
- Vercel - Recommended for Nuxt apps
- Netlify - Good alternative
- DigitalOcean - Full control with droplets
- Railway - Easy deployment with databases
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feat/amazing-feature) - Commit your changes using conventional commits
- Push to the branch (
git push origin feat/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
nuicoder
- GitHub: @nuicoder
If you have any questions or need help, please open an issue on GitHub.
Built with β€οΈ using Nuxt 4, Prisma, TypeScript & PostgreSQL



