Thanks to visit codestin.com
Credit goes to github.com

Skip to content

This project is optimized for development with Cursor, an AI-powered code editor that enhances your coding experience

Notifications You must be signed in to change notification settings

reallongnguyen/nestjs-vibe-coding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

NestJS Vibe Coding Template

NestJS TypeScript Prisma License: MIT PRs Welcome

A robust and flexible NestJS backend template designed for microservice-ready architecture with modular components that can be easily customized and deployed.

✨ Features

  • Microservice Architecture: Designed with modularity in mind, ready to split into separate microservices
  • Prisma ORM: Type-safe database client for PostgreSQL integration
  • JWT Authentication: Secure authentication & role-based authorization
  • Event-Driven: Event system for asynchronous communication between modules
  • OpenAPI Documentation: Automatic API documentation generation
  • Container Ready: Docker and Kubernetes compatible

πŸ“¦ Module Structure

Module Features Status Dependencies
Common Core utilities, error handling, logger Beta PostgreSQL
Identity User management, authentication Alpha PostgreSQL, Gotrue
Content Posts, stories, tweets Alpha PostgreSQL
Social Comments, likes, follows Alpha PostgreSQL
Notification User notifications Alpha PostgreSQL, Redis, MQTT
Feed User activity feeds Alpha PostgreSQL, Redis
Storage File uploads and management Alpha Google Cloud Storage
Gamification Points, badges, rewards Alpha PostgreSQL
User-Follow User follow relationships Beta PostgreSQL
Invitation User invitations Beta PostgreSQL
Recommendation Content recommendations Alpha PostgreSQL, Redis, Gorse
Search Search functionality - PostgreSQL
Payment Payment processing - PostgreSQL
AI AI integrations - Planned
Analytic Data analytics Planned PostgreSQL

🧩 Vibe Coding with Cursor

This project is optimized for development with Cursor, an AI-powered code editor that enhances your coding experience.

Getting Started with Cursor

  1. Install Cursor: Download from https://cursor.so/
  2. Open this Project: Use File > Open to navigate to the project
  3. Use AI Commands: Press Ctrl+K or Cmd+K to open the AI command palette

Cursor helps you understand the codebase faster and implement features more efficiently by providing context-aware AI assistance.

πŸš€ Quick Start

Setup

# Clone and install
git clone https://github.com/reallongnguyen/nestjs-vibe-coding
cd nestjs-vibe-coding
pnpm install

# Configure environment
cp .env.example .env

# Start dependencies (PostgreSQL, Redis, MQTT)
docker compose up -d

# Setup database
npx prisma db push

# Create Root user
export ROOT_USER_AUTH_ID=437834e3-6fa8-4db3-9f8a-a0402f5d0814
npx prisma db seed

Development

# Start dev server with hot reload
pnpm start:dev

# Start production server
pnpm build
pnpm start:prod

πŸ”‘ Authentication & API Testing

Using Swagger UI

You can test the API endpoints using Swagger UI at http://localhost:8000/api.

To authenticate:

  1. Click the "Authorize" button in Swagger UI
  2. Enter your JWT token in the format: your_token_here

For testing purposes, you can generate a valid JWT using:

# Using node
node -e "require('dotenv').config(); console.log(require('jsonwebtoken').sign({ sub: '437834e3-6fa8-4db3-9f8a-a0402f5d0814' }, process.env.JWT_SECRET ?? 'secret', { expiresIn: '1h' }))"

Getting Your Own Access Token (GoTrue API)

This project uses Supabase GoTrue for authentication. Here's how to get your own access token:

  1. Sign Up
curl -X POST 'http://localhost:9999/auth/v1/signup' \
-H "apikey: your-anon-key" \
-H "Content-Type: application/json" \
-d '{
  "email": "[email protected]",
  "password": "your-password"
}'
  1. Sign In
curl -X POST 'http://localhost:9999/auth/v1/token?grant_type=password' \
-H "apikey: your-anon-key" \
-H "Content-Type: application/json" \
-d '{
  "email": "[email protected]",
  "password": "your-password"
}'

Response will include your access token:

{
  "access_token": "your.jwt.token",
  "token_type": "bearer",
  "expires_in": 3600,
  "refresh_token": "your-refresh-token"
}
  1. Using the Token
  • In API requests, add the header: Authorization: Bearer your.jwt.token
  • In Swagger UI, click "Authorize" and enter: Bearer your.jwt.token

For more authentication options and details, see the Supabase GoTrue documentation.

πŸ”§ Customizing Your Project

Removing Unused Modules

The template is designed to be modular, making it easy to remove unnecessary components:

  1. Remove the module directory from src/
  2. Remove the module import from src/app.module.ts
  3. Remove related database schema from prisma/schema.prisma (if applicable)

Example:

// src/app.module.ts
@Module({
  imports: [
    CommonModule,
    IdentityModule,
    // Remove the line below to remove the ContentModule
    // ContentModule,
    SocialModule,
    // ...other modules
  ],
  controllers: [AppController],
})
export class AppModule {}

πŸ“š Infrastructure and Deployment

This template uses Docker and docker-compose for local development. For production deployment, we recommend:

  • Kubernetes: For orchestrating the microservices
  • Cloud Providers: AWS, GCP, or Azure for managed infrastructure

See the deployment documentation for detailed instructions on deploying to different environments.

🀝 Contributing

Contributions are welcome! Whether it's:

  • πŸ› Reporting a bug
  • πŸ’‘ Requesting a feature
  • πŸ“ Improving documentation
  • πŸ§‘β€πŸ’» Submitting a PR

Please check out our Contribution Guidelines before making a contribution.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Nguyen Phuc Long

About

This project is optimized for development with Cursor, an AI-powered code editor that enhances your coding experience

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •