This is a Next.js application for the KhmerCoders community platform built with TypeScript, using Drizzle ORM with SQLite (via Cloudflare D1), and Tailwind CSS for styling.
Primary Schema File: src/libs/db/schema.ts
This file contains all database table definitions using Drizzle ORM for SQLite. Check this file to understand the current database structure and available tables.
Actions Directory: src/server/actions/
For examples of how to implement server actions, refer to these files:
src/server/actions/likes.ts- Example of simple CRUD operations with atomic updatessrc/server/actions/follower.ts- Example of relationship management with batch operations
All server actions use the withAuthAction middleware wrapper and follow consistent patterns for authentication, error handling, and database operations.
Services Directory: src/server/services/
Services is for getting data from the database or manipulating data before sending it to the client.
If you work with table, you can always follow existing pattern at /app/users/page.tsx