Aplikasi fullstack CRUD sederhana dengan arsitektur modern menggunakan Next.js untuk frontend dan Hono.js untuk backend dengan Clean Architecture.
DENONEXT/
βββ apps/
β βββ frontend/ # Next.js + TypeScript + shadcn/ui
β β βββ app/ # App Router
β β βββ components/ # UI Components
β β βββ features/ # Feature-based modules
β β βββ lib/ # Utilities
β β
β βββ backend/ # Node.js + Hono + Prisma + Clean Arch
β βββ src/
β β βββ domain/ # Business Entities
β β βββ application/ # Use Cases
β β βββ infrastructure/ # Data Access
β β βββ presentation/ # Controllers
β β βββ shared/ # Utilities
β βββ api/ # API Routes
β βββ prisma/ # Database Schema & Seeds
β βββ utils/ # Validators
β
βββ packages/
β βββ shared/ # Shared types & utilities
β
βββ .env # Environment variables
βββ vercel.json # Deployment config
βββ README.md # This file
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- State Management: React Query (TanStack Query)
- Form Handling: React Hook Form + Zod
- Framework: Hono.js
- Runtime: Node.js
- Language: TypeScript
- Database: PostgreSQL (Supabase)
- ORM: Prisma
- Validation: Zod
- Architecture: Clean Architecture
- Provider: Supabase (PostgreSQL)
- ORM: Prisma
- Migrations: Prisma Migrate
- Platform: Vercel
- Database: Supabase
- Node.js 18+
- npm atau yarn
- Supabase account
git clone <repository-url>
cd DenoNext
# Install backend dependencies
cd apps/backend
npm install
# Install frontend dependencies (when ready)
cd ../frontend
npm installFile .env sudah tersedia dengan konfigurasi Supabase:
# Database
DATABASE_URL=postgresql://postgres.tycvfsxavggglwlmapez:Fullbuster157Rust@aws-0-ap-southeast-1.pooler.supabase.com:6543/postgres
# Backend Config
APP_ENV=development
APP_PORT=8000
APP_VERSION=1.0.0
CORS_ORIGIN=http://localhost:3000
LOG_LEVEL=infocd apps/backend
# Generate Prisma client
npm run db:generate
# Run migrations
npm run db:migrate
# Seed database
npm run db:seedBackend:
cd apps/backend
npm run devServer akan berjalan di http://localhost:8000
Frontend (coming soon):
cd apps/frontend
npm run devApp akan berjalan di http://localhost:3000
Backend API sudah siap dengan endpoints berikut:
http://localhost:8000
GET /- Health checkGET /api/users- Get semua usersGET /api/users/:id- Get user by IDPOST /api/users- Create user baruPUT /api/users/:id- Update userDELETE /api/users/:id- Delete userGET /api/users/count- Get jumlah users
# Create user
curl -X POST http://localhost:8000/api/users \
-H "Content-Type: application/json" \
-d '{
"email": "john@example.com",
"name": "John Doe"
}'{
"success": true,
"message": "User created successfully",
"data": {
"id": "clx1234567890",
"email": "john@example.com",
"name": "John Doe",
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z"
},
"timestamp": "2024-01-01T12:00:00.000Z"
}Backend menggunakan Clean Architecture dengan separation of concerns:
π domain/ # Business logic & entities
π application/ # Use cases & business rules
π infrastructure/ # Data access & external services
π presentation/ # Controllers & HTTP handlers
π shared/ # Common utilities
- β Maintainable - Easy to modify and extend
- β Testable - Each layer can be tested independently
- β Scalable - Clean separation allows easy scaling
- β Readable - Clear structure and naming conventions
- β Reusable - Components can be reused across projects
cd apps/backend
# Development
npm run dev # Start dengan hot reload
npm run build # Build production
npm start # Start production server
# Database
npm run db:generate # Generate Prisma client
npm run db:migrate # Run migrations
npm run db:seed # Seed database
npm run db:studio # Open Prisma Studio
# Code Quality
npm run type-check # TypeScript checking
npm run lint # ESLint
npm run format # Prettiercd apps/frontend
npm run dev # Development server
npm run build # Build production
npm run start # Start production
npm run lint # ESLint
npm run type-check # TypeScript checkingmodel User {
id String @id @default(cuid())
email String @unique
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("users")
}Frontend akan menggunakan shadcn/ui components:
- Button, Input, Card
- Form, Dialog, Toast
- Table, Pagination
- Loading states
- Error boundaries
-
Backend Development β
- Setup Hono.js server
- Implement Clean Architecture
- Create CRUD APIs
- Add validation & error handling
- Database integration
-
Frontend Development π§ (Next Phase)
- Setup Next.js project
- Create UI components
- Implement API integration
- Add form handling
- State management
-
Integration & Deployment π (Future)
- Connect frontend to backend
- Add authentication
- Deploy to Vercel
- CI/CD pipeline
# Deploy backend
cd apps/backend
vercel --prod
# Deploy frontend (when ready)
cd apps/frontend
vercel --prodConfigure di Vercel dashboard:
DATABASE_URLAPP_ENV=productionCORS_ORIGIN=https://your-frontend-domain.vercel.app
- Project structure setup
- Hono.js server configuration
- Clean Architecture implementation
- Prisma ORM integration
- CRUD API endpoints
- Request validation
- Error handling
- Database seeding
- Next.js project setup
- shadcn/ui components
- API integration
- User management UI
- Form handling
- State management
- Authentication & Authorization
- File upload
- Pagination & Search
- Real-time updates
- Testing suite
- Performance optimization
cd apps/backend
# Unit tests
npm run test
# Integration tests
npm run test:integration
# E2E tests
npm run test:e2ecd apps/frontend
# Unit tests
npm run test
# E2E tests
npm run test:e2e-
Database Connection Error
- Check
DATABASE_URLin.env - Verify Supabase connection
- Run
npm run db:generate
- Check
-
Port Already in Use
# Kill process on port lsof -ti:8000 | xargs kill -9
-
TypeScript Errors
# Reinstall dependencies rm -rf node_modules npm install
- Backend README - Detailed backend documentation
- Frontend README - Frontend documentation (coming soon)
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Your Name
- GitHub: @yourusername
- Email: your.email@example.com
Happy Coding! π
Note: Frontend development akan dimulai setelah backend selesai. Backend sudah siap dan fully functional dengan Clean Architecture.