A full-stack learning management system built with Next.js + Go + PostgreSQL. This platform enables course creation, enrollment management, and payment processing for online education.
- Project Overview
- Tech Stack
- Project Structure
- Prerequisites
- Getting Started
- API Documentation
- Database
- Development
- Deployment
Doscom Web is a comprehensive learning management system featuring:
- User Management: Registration, authentication (JWT + OAuth Google), user profiles & avatars
- Course Management: Create, manage, and organize courses with modules and lessons
- Enrollment System: Students can enroll in courses and track progress
- Payment Integration: Seamless payment processing via Tripay gateway
- Course Reviews: Students can review and rate courses
- Responsive Design: Modern UI with Tailwind CSS
- Framework: Next.js 15.5.6 with TypeScript
- Styling: Tailwind CSS 4
- Runtime: Node.js with hot reload support
- Language: Go 1.25.1
- Framework: Gin Web Framework
- Database: PostgreSQL 15
- ORM: GORM
- Authentication: JWT + Google OAuth
- API Documentation: Swagger/OpenAPI
- Payment Gateway: Tripay API
- Containerization: Docker & Docker Compose
- Database Admin: Adminer (Web UI for PostgreSQL)
web-DU/
βββ frontend/ # Next.js frontend application
β βββ src/
β β βββ app/ # Next.js app directory
β β β βββ globals.css
β β β βββ layout.tsx
β β β βββ page.tsx
β β βββ components/ # Reusable React components
β βββ package.json
β βββ tsconfig.json
β βββ Dockerfile
β
βββ backend/ # Go backend application
β βββ internal/
β β βββ database/ # PostgreSQL connection & migrations
β β βββ handler/ # HTTP request handlers & middleware
β β β βββ middleware/ # JWT, CORS, auth middleware
β β β βββ routes/ # API route definitions
β β βββ model/ # Data models
β β β βββ dto/ # Data Transfer Objects
β β β βββ entity/ # Database entities
β β βββ service/ # Business logic
β β βββ utils/ # Helper functions (bcrypt, payments)
β βββ public/
β β βββ uploads/ # User uploads (avatars, course images)
β βββ docs/ # Swagger API documentation
β βββ main.go
β βββ go.mod
β βββ Dockerfile
β
βββ docker-compose.yml # Docker Compose configuration
βββ README.md # This file
Ensure you have the following installed:
- Docker (v20+) & Docker Compose (v2+)
- Git
- (Optional) Go (v1.25+) for local backend development
- (Optional) Node.js (v18+) & npm for local frontend development
git clone https://github.com/Dinus-Open-Source-Community/web-DU.git
cd web-DUCreate a .env file in the root directory with the following variables:
# Database
DB_HOST=db
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your_password
DB_NAME=doscom
DB_SSLMODE=disable
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password
POSTGRES_DB=doscom
# Backend
BASE_URL=http://localhost:8080
JWT_SECRET_KEY=your_jwt_secret_key
# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# Encryption
AES_KEY=your_aes_key_32_chars_long
# Tripay Payment Gateway
TRIPAY_API_KEY=your_tripay_api_key
TRIPAY_PRIVATE_KEY=your_tripay_private_key
TRIPAY_MERCHANT_CODE=your_merchant_code
HMAC_KEY=your_hmac_key
# Frontend
NEXT_PUBLIC_API_URL=http://localhost:8080docker-compose up --buildThis will start all services:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
- Swagger Documentation: http://localhost:8080/swagger/index.html
- Adminer (Database UI): http://localhost:8012
docker-compose downThe API documentation is available via Swagger/OpenAPI:
URL: http://localhost:8080/swagger/index.html
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/google- Google OAuth callbackPOST /api/auth/refresh- Refresh JWT token
GET /api/users/:id- Get user profilePUT /api/users/:id- Update user profilePOST /api/users/:id/avatar- Upload user avatar
GET /api/courses- List all coursesPOST /api/courses- Create new course (instructor only)GET /api/courses/:id- Get course detailsPUT /api/courses/:id- Update course (instructor only)DELETE /api/courses/:id- Delete course (instructor only)
POST /api/enrollments- Enroll in a courseGET /api/enrollments- List user enrollmentsGET /api/enrollments/:id- Get enrollment details
POST /api/payments- Create paymentGET /api/payments/:id- Get payment statusPOST /api/payments/callback- Tripay webhook callback
GET /api/modules/:id/lessons- Get lessons in a modulePOST /api/lessons/:id/complete- Mark lesson as complete
The PostgreSQL database is automatically initialized via Docker Compose. The database includes the following main tables:
- users - User accounts with roles (student/instructor)
- courses - Course information
- enrollments - Student course enrollments
- modules - Course modules
- lessons - Course lessons
- payments - Payment records
- course_reviews - Student course reviews
- course_announcements - Course announcements
Adminer UI: http://localhost:8012
- Server:
db - User:
postgres - Password: (from
.envPOSTGRES_PASSWORD) - Database: (from
.envPOSTGRES_DB)
cd frontend
npm install
npm run devAccess at http://localhost:3000
cd backend
go mod download
go run main.goBackend runs on http://localhost:8080
The API uses JWT (JSON Web Tokens) for authentication. Include the token in the Authorization header:
Authorization: Bearer YOUR_JWT_TOKENSign in with Google account for seamless authentication. Requires valid GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET.
This project integrates with Tripay payment gateway for course payments. Features include:
- Multiple payment methods support
- Real-time payment status updates
- Webhook callback handling
- HMAC signature verification for security
Refer to Tripay Documentation for more details.