A comprehensive fullstack Web3 training project built with modern technologies and best practices. This monorepo includes a Next.js frontend, NestJS backend API, AWS CDK infrastructure, and shared packages for a complete Web3 application development experience.
Before setting up this project, ensure you have the following installed:
- Node.js >= 20.x
- pnpm >= 10.4.1 (recommended package manager)
- Git for version control
- AWS CLI (for infrastructure deployment)
- Docker (optional, for database)
βββ apps/
β βββ web/ # Next.js frontend application
β βββ be/ # NestJS backend API with Prisma
β βββ cdk/ # AWS CDK infrastructure
βββ packages/
β βββ ui/ # Shared UI components (Shadcn/ui)
β βββ helpers/ # Utility functions and helpers
β βββ eslint-config/ # Shared ESLint configuration
β βββ typescript-config/ # Shared TypeScript configuration
βββ scripts/ # Build and deployment scripts
# Clone the repository
git clone <repository-url>
cd fullstack-web3-training
# Install dependencies for all packages
pnpm install
Each application requires its own environment configuration:
# Navigate to backend
cd apps/be
# Create environment files
cp .env.example .env.local
cp .env.example .env.dev
# Configure your environment variables in .env.local and .env.dev
# Navigate to frontend
cd apps/web
# Create environment file
cp .env.example .env.local
# Configure your environment variables
# From the backend directory (apps/be)
cd apps/be
# Generate Prisma client
pnpm prisma:generate:dev
# Run database migrations
pnpm prisma:migrate:dev
# Seed the database (optional)
pnpm prisma:reset:local
From the root directory, you can start all applications:
# Start all apps in development mode
pnpm dev
Or start individual applications:
# Frontend only (Next.js)
cd apps/web
pnpm dev
# Backend only (NestJS)
cd apps/be
pnpm dev
# Frontend runs on: http://localhost:3000
# Backend API runs on: http://localhost:4000
# Development
pnpm dev # Start all apps in development mode
pnpm build # Build all packages and apps
pnpm lint # Lint all packages
pnpm lint:fix # Fix linting issues
pnpm format # Format code with Prettier
pnpm type-check # Type check all TypeScript
# Testing
pnpm test # Run tests across all packages
pnpm dev # Start Next.js development server
pnpm build # Build for production
pnpm start # Start production server
pnpm lint # Lint frontend code
pnpm type-check # Type check frontend
pnpm dev # Start NestJS development server
pnpm build # Build backend for production
pnpm start:local # Start with local environment
pnpm test # Run backend tests
# Database commands
pnpm prisma:generate:dev # Generate Prisma client
pnpm prisma:migrate:dev # Run database migrations
pnpm prisma:reset:local # Reset and seed database
pnpm build # Build CDK application
pnpm cdk # Run AWS CDK commands
pnpm bootstrap:dev # Bootstrap CDK for development
pnpm deploy:dev:local # Deploy to development environment
This project uses Shadcn/ui for consistent, accessible UI components.
# Add a new Shadcn component to the UI package
pnpm dlx shadcn@latest add button -c apps/web
// Import from the shared UI package
import { Button, Card, Input } from "@workspace/ui/components/ui"
// Use in your components
export function MyComponent() {
return (
<Card className="p-6">
<Input placeholder="Enter text..." />
<Button>Submit</Button>
</Card>
)
}
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: TailwindCSS + Shadcn/ui
- State Management: Zustand + React Query
- Forms: React Hook Form + Zod
- Framework: NestJS
- Database: PostgreSQL with Prisma ORM
- Authentication: JWT + Passport
- API Documentation: Swagger/OpenAPI
- Deployment: AWS Lambda (Serverless)
- Platform: AWS CDK (TypeScript)
- Deployment: Serverless architecture
- Services: Lambda, RDS, API Gateway, CloudFront
- @workspace/ui: Shadcn/ui components and custom UI
- @workspace/helpers: Utility functions and helpers
- @workspace/eslint-config: Shared linting rules
- @workspace/typescript-config: Shared TypeScript configuration
# Reset database and apply all migrations
pnpm prisma:reset:local
# Create and apply new migration
pnpm prisma:migrate:dev
# Open Prisma Studio (Database GUI)
pnpm prisma studio
# Development environment
pnpm prisma:migrate:dev
pnpm prisma:reset:dev
# Staging environment
pnpm prisma:migrate:spec
pnpm prisma:reset:spec
# Build and deploy backend to AWS
cd apps/be
pnpm build
cd ../cdk
pnpm deploy:dev:quick
# Build frontend for production
cd apps/web
pnpm build
# Deploy to your hosting platform (Vercel, Netlify, etc.)
# Run all tests
pnpm test
# Backend tests
cd apps/be
pnpm test
pnpm test:watch
pnpm test:cov
# Frontend tests (when configured)
cd apps/web
pnpm test
- ESLint: Enforced across all packages
- Prettier: Consistent code formatting
- TypeScript: Strict type checking
- Husky: Pre-commit hooks for quality assurance
This project follows conventional commits:
feat: add new user authentication
fix: resolve database connection issue
docs: update setup instructions
# Create a new package in the packages/ directory
mkdir packages/new-package
cd packages/new-package
# Initialize with package.json
pnpm init
# Add to pnpm-workspace.yaml if needed
- Port conflicts: Ensure ports 3000 (frontend) and 4000 (backend) are available
- Database connection: Verify PostgreSQL is running and environment variables are correct
- Dependencies: Run
pnpm install
from the root if packages are missing - Prisma issues: Run
pnpm prisma:generate:dev
after schema changes
- Check the logs in your terminal for detailed error messages
- Ensure all environment variables are properly configured
- Verify that all prerequisites are installed with correct versions
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes following the project conventions
- Run tests and linting:
pnpm lint && pnpm test
- Commit using conventional commits
- Push to your branch and create a Pull Request
This project is for educational purposes as part of the Fullstack Web3 Training program.
Ready to build amazing Web3 applications! π