This document serves as the primary technical reference for the 3Dēx project.
- Project Overview
- Tech Stack Overview
- Core Principles
- Installation Guide
- Cloning the Project
- Project Structure
- Environment Variables
- Database Setup (PostgreSQL + Prisma)
- Running the Project
- Verification Checklist
- Git Workflow
- Working with a New Local Copy
- Updating an Existing Local Copy
- Safe Merging Strategy
- Troubleshooting
- Roadmap: Full Dockerization
- Core Rules
3Dēx is a completed MVP for a 3D services and asset marketplace featuring:
Frontend: Next.js + Tailwind
Backend: Node.js + Express
Database: PostgreSQL + Prisma
This guide details the setup and development processes to ensure consistent implementation and avoid breaking changes.
| Layer | Technology |
|---|---|
| Frontend | Next.js (React), Tailwind CSS |
| Backend | Node.js, Express |
| Database | PostgreSQL |
| ORM | Prisma |
| Storage | MinIO (S3 Compatible) |
| AI / Ecosystem | Google Gemini (Dēxie AI) |
| Version Control | Git + GitHub |
- Code is shared across the team.
- Database data is maintained locally and not shared.
- Storage buckets are local for development purposes.
- Secrets must never be committed to version control.
- Features are developed on dedicated branches, not on the master branch.
If you are new to these concepts, this guide will help you follow these practices.
- Windows: git-scm.com/download/win
- Linux:
sudo apt install git
Verify: git --version
- Download from: nodejs.org (Choose the LTS version)
Verify: node -v, npm -v
- Windows: postgresql.org/download/windows/
- Linux:
sudo apt install postgresql postgresql-contrib
Verify: psql --version, pg_isready
Note: Verification depends on whether PostgreSQL is installed as a service.
MinIO can be run via Docker:
docker run -p 9000:9000 -p 9001:9001 minio/minio server /data --console-address ":9001"git clone https://github.com/Schryzon/3Dex.git
cd 3Dex3Dex/
├─ .github/ # CI/CD workflows
├─ .vscode/ # Workspace settings
├─ apps/
│ ├─ backend/ # Express backend
│ └─ frontend/ # Next.js frontend
├─ docs/ # Technical documentation
├─ LICENSE # Project license
└─ README.md # Main documentation
Avoid adding redundant folders or storing databases within the repository.
Copy apps/backend/.env.example to apps/backend/.env. Key variables to update:
DATABASE_URL="postgresql://YOUR_USERNAME:YOUR_PASSWORD@localhost:5432/threedex"
PORT=4000
JWT_SECRET="your_secure_random_string"
STORAGE_ENDPOINT="http://localhost:9000"
STORAGE_ACCESS_KEY="minioadmin"
STORAGE_SECRET_KEY="minioadmin"
STORAGE_BUCKET="3dex-models"
SB_MIDTRANS_SERVER_KEY="sandbox-midtrans-server-key"
GEMINI_API_KEY="your-google-ai-studio-key"Copy apps/frontend/.env.local.example to apps/frontend/.env.local. Key variables to update:
NEXT_PUBLIC_API_URL=http://localhost:4000/api
NEXT_PUBLIC_SITE_URL=http://localhost:3000
NEXT_PUBLIC_MINIO_URL=http://localhost:9000
NEXT_PUBLIC_SB_MIDTRANS_CLIENT_KEY=your_sandbox_key_hereFor Docker Compose Only.
Copy .env.docker.example to .env.docker.
Never commit these files; they are included in .gitignore.
If PostgreSQL is not running as a service, start it manually:
pg_ctl start -D $env:PGDATAThen, from apps/backend:
npm install
npx prisma migrate dev --name init
npx prisma generateSuccess indicators:
- PostgreSQL is running.
- Prisma connected successfully.
To stop PostgreSQL: pg_ctl stop
cd apps/backend
npm run devHealth check: http://localhost:4000/health (Expected: { "status": "ok" })
cd apps/frontend
npm install
npm run devAccess via: http://localhost:3000
- Frontend loads correctly.
- Backend
/healthendpoint returns "ok". - No console errors.
- Prisma migrations completed successfully.
git checkout dev
git pull origin dev
git checkout -b feature/your-task-namegit add .
git commit -m "Brief description of changes"
git push -u origin feature/your-task-namegit clone https://github.com/Schryzon/3Dex.git
cd 3Dex
git checkout devFollow the setup steps mentioned above.
git checkout dev
git pull origin dev
git checkout -b feature/new-taskgit checkout dev
git pull origin devgit checkout feature/your-task
git merge devResolve any conflicts locally in the feature branch.
git checkout dev
git merge feature/your-task
git push origin devgit branch -d feature/your-task
git push origin --delete feature/your-task-
"Git overwrote my work": Ensure you commit your changes before pulling updates.
git add . git commit -m "wip" git pull
-
"Prisma connection error": Verify PostgreSQL is running on the expected port (default 5432).
pg_isready
If migrating fails with missing modules, verify package versions match or re-run
npm install. -
"Missing Midtrans errors in Cart Checkout": Ensure that
USE_MOCK_DATA=falseinsidesrc/lib/api/services/product.service.tsso the real Midtrans sandbox environment is utilized.
The project uses GitHub Actions for CI/CD and PM2 for process management on the production server.
- GitHub Actions: Whenever designated branches (
dev,master) are updated, GitHub Actions usesdeploy.ymlto trigger continuous deployment. - Server (PM2): The application is managed via
ecosystem.config.js.Ensure PM2 is installed globally on the target server.pm2 start ecosystem.config.js
The project is currently transitioning from a local-first development model to a fully containerized environment.
- Backend Dockerfile (Production-ready)
- Shared PostgreSQL Container
- Frontend Dockerfile (SSR/Next.js multi-stage)
- MinIO Browser & Console Container
- Centralized Docker Networking (Internal communication)
- Unified
docker-compose.prod.yml
- Frontend Integration: Develop an alpine-based image for the Next.js frontend that supports both development (
npm run dev) and production (npm run start) modes. - MinIO Persistence: Add a dedicated
minioservice todocker-compose.ymlto eliminate the need for manual Docker run commands for storage. - Internal API Resolution: Configure Docker's internal DNS so the frontend can resolve
api:4000without exposing ports unnecessarily.
- Do not code directly on the master branch.
- Always branch from the dev branch.
- Never commit environment variables (.env).
- Dedicate one branch per task.
- Do not share local database data.
- Consult the team Lead or documentation if issues persist.