Skip to content

Dinus-Open-Source-Community/web-DU

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

54 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Doscom Web Platform (Dinus Open Source Community)

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.


πŸ“‹ Table of Contents


🎯 Project Overview

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

πŸ›  Tech Stack

Frontend

Backend

Infrastructure

  • Containerization: Docker & Docker Compose
  • Database Admin: Adminer (Web UI for PostgreSQL)

πŸ“ Project Structure

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

πŸ“¦ Prerequisites

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

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/Dinus-Open-Source-Community/web-DU.git
cd web-DU

2. Environment Variables

Create 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:8080

3. Run with Docker Compose

docker-compose up --build

This will start all services:

4. Stop the Project

docker-compose down

πŸ“š API Documentation

The API documentation is available via Swagger/OpenAPI:

URL: http://localhost:8080/swagger/index.html

Main API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/google - Google OAuth callback
  • POST /api/auth/refresh - Refresh JWT token

Users

  • GET /api/users/:id - Get user profile
  • PUT /api/users/:id - Update user profile
  • POST /api/users/:id/avatar - Upload user avatar

Courses

  • GET /api/courses - List all courses
  • POST /api/courses - Create new course (instructor only)
  • GET /api/courses/:id - Get course details
  • PUT /api/courses/:id - Update course (instructor only)
  • DELETE /api/courses/:id - Delete course (instructor only)

Enrollments

  • POST /api/enrollments - Enroll in a course
  • GET /api/enrollments - List user enrollments
  • GET /api/enrollments/:id - Get enrollment details

Payments

  • POST /api/payments - Create payment
  • GET /api/payments/:id - Get payment status
  • POST /api/payments/callback - Tripay webhook callback

Lessons & Modules

  • GET /api/modules/:id/lessons - Get lessons in a module
  • POST /api/lessons/:id/complete - Mark lesson as complete

πŸ—„ Database

PostgreSQL Setup

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

Access Database

Adminer UI: http://localhost:8012

  • Server: db
  • User: postgres
  • Password: (from .env POSTGRES_PASSWORD)
  • Database: (from .env POSTGRES_DB)

πŸ’» Development

Frontend Development

cd frontend
npm install
npm run dev

Access at http://localhost:3000

Backend Development

cd backend
go mod download
go run main.go

Backend runs on http://localhost:8080


πŸ” Authentication

JWT Token

The API uses JWT (JSON Web Tokens) for authentication. Include the token in the Authorization header:

Authorization: Bearer YOUR_JWT_TOKEN

Google OAuth

Sign in with Google account for seamless authentication. Requires valid GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET.


πŸ’³ Payment Integration

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages