A comprehensive Vietnamese lunar calendar web application with event management and cultural context.
- Vietnamese Lunar Calendar: Complete lunar calendar with Vietnamese terminology and cultural context
- Event Management: Create and manage Vietnamese cultural events, ancestor worship dates, and personal reminders
- Cultural Context: Built-in Vietnamese holidays, zodiac information, and traditional observances
- Progressive Web App: Install as native app with offline functionality
- Authentication: Secure user accounts with Email/Password
- Export Functionality: Export calendars to various formats
- Modern UI: Responsive design optimized for Vietnamese users
- Push Notifications: Get notified about upcoming events (Mồng 1, Rằm, personal events, shared events)
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
- Backend: tRPC, NextAuth.js, Prisma ORM
- Database: PostgreSQL with Vietnamese cultural data
- UI Components: shadcn/ui, Radix UI
- Lunar Calculations: Chinese Lunar Calendar libraries with Vietnamese adaptations
- Node.js 18+ and pnpm
- Docker (for PostgreSQL)
- Git
git clone <your-repo-url>
cd am-lich
pnpm installCopy the example environment file:
cp .env.example .envFill in your environment variables:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/amlich"
# NextAuth
AUTH_SECRET="your-secret-key"
NEXTAUTH_URL="http://localhost:3000"
# Email (Resend)
RESEND_API_KEY="your-resend-api-key"
EMAIL_FROM="noreply@yourdomain.com"
# Push Notifications (VAPID Keys)
# Generate with: npx web-push generate-vapid-keys
NEXT_PUBLIC_VAPID_PUBLIC_KEY="your-vapid-public-key"
VAPID_PRIVATE_KEY="your-vapid-private-key"
VAPID_SUBJECT="mailto:your-email@example.com"
# Vercel Cron Secret (generate a random string)
CRON_SECRET="your-random-secret"To enable push notifications, you need to generate VAPID keys:
# Install web-push globally (if not already installed)
npm install -g web-push
# Generate VAPID keys
web-push generate-vapid-keysCopy the generated keys into your .env file:
NEXT_PUBLIC_VAPID_PUBLIC_KEY- The public keyVAPID_PRIVATE_KEY- The private keyVAPID_SUBJECT- Your email address (e.g.,mailto:you@example.com)
On the Vercel Hobby plan, cron jobs have the following limitations:
- Hourly precision: Cron jobs can only run at the start of each hour
- Execution delay: Jobs scheduled for a specific hour may run anytime within that hour (e.g., 8:00 job could run at 8:00, 8:30, or 8:59)
- User impact: Notifications may arrive up to 59 minutes after the user's preferred time
This means if a user sets notifications for 8:00 AM, they might receive them anytime between 8:00 AM and 8:59 AM. This is a platform limitation on the free tier.
Start PostgreSQL using Docker:
./start-database.shRun database migrations:
pnpm run db:generatepnpm run devOpen http://localhost:3000 in your browser.
./start-database.sh- Start PostgreSQL with Dockerpnpm run db:generate- Run Prisma migrations in developmentpnpm run db:migrate- Deploy Prisma migrations to productionpnpm run db:push- Push schema changes to databasepnpm run db:studio- Open Prisma Studio
pnpm run dev- Start development serverpnpm run build- Build for productionpnpm run start- Start production serverpnpm run preview- Build and start production server
pnpm run lint- Run ESLintpnpm run lint:fix- Run ESLint with auto-fixpnpm run typecheck- Run TypeScript type checkingpnpm run check- Run both linting and type checkingpnpm run format:check- Check code formattingpnpm run format:write- Format code with Prettier
pnpm run test- Run tests in watch modepnpm run test:run- Run tests oncepnpm run test:coverage- Run tests with coverage
pnpm run ui:add- Add new shadcn/ui components
src/
├── app/ # Next.js App Router
│ ├── (app)/ # Protected app routes (dashboard, events)
│ ├── (auth)/ # Authentication routes (login, signup)
│ ├── api/ # API routes
│ └── layout.tsx # Root layout
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── lunar/ # Vietnamese lunar calendar components
│ └── ... # Custom components
├── lib/ # Utility functions
│ ├── lunar-calendar.ts # Vietnamese lunar calendar logic
│ └── vietnamese-localization.ts # Vietnamese language support
├── server/ # Server-side code
│ ├── api/routers/ # tRPC API routers
│ ├── auth/ # NextAuth configuration
│ └── db.ts # Database client
└── styles/ # Global styles
The application includes comprehensive models for Vietnamese lunar calendar functionality:
- User: User accounts with email/password authentication
- Account: Account connections for authentication providers
- Session: User sessions
- VerificationToken: Email verification tokens
- VietnameseLunarEvent: Vietnamese cultural events with lunar dates, zodiac years, and ancestor worship support
- VietnameseHoliday: Traditional Vietnamese holidays and their cultural significance
- VietnameseZodiacInfo: Vietnamese zodiac system with Can Chi combinations
- View current Vietnamese lunar date with proper terminology (Mồng 1, Rằm, etc.)
- Browse lunar months with Vietnamese zodiac information
- See upcoming important dates and cultural significance
- Traditional Vietnamese holiday integration
- Create Vietnamese cultural events with lunar dates
- Ancestor worship scheduling (giỗ tổ tiên)
- Annual recurring events for traditional celebrations
- Event export to various calendar formats
- Create new pages in
src/app/(app)/for authenticated features - Add tRPC routers in
src/server/api/routers/ - Create UI components in
src/components/
- Modify
prisma/schema.prisma - Run
pnpm run db:generateto create migrations - Update tRPC routers and API endpoints
- Update
src/lib/vietnamese-localization.tsfor new text - Add cultural context to calendar components
- Follow Vietnamese design patterns
Ensure all production environment variables are set:
DATABASE_URL- Production PostgreSQL connectionAUTH_SECRET- Strong random secret (useopenssl rand -base64 32)NEXTAUTH_URL- Your production domainRESEND_API_KEYandEMAIL_FROMNEXT_PUBLIC_VAPID_PUBLIC_KEY,VAPID_PRIVATE_KEY,VAPID_SUBJECT- For push notificationsCRON_SECRET- Random secret for securing cron jobs
Note: VAPID keys must be generated before deployment. See Generating VAPID Keys section above.
pnpm run db:migratepnpm run build
pnpm run startThis application is designed specifically for the Vietnamese community and incorporates:
- Traditional Vietnamese lunar calendar terminology
- Vietnamese zodiac system (Can Chi)
- Cultural significance of dates like Mồng 1 (new moon) and Rằm (full moon)
- Ancestor worship scheduling (giỗ tổ tiên)
- Vietnamese traditional holidays and observances
- Fork the repository
- Create a feature branch
- Make your changes
- Run
pnpm run checkto ensure code quality - Test with Vietnamese cultural context
- Submit a pull request