Welcome to the Artisan Hub Backend repository! This is the Node.js + Express REST API for the Artisan Hub platform.
🔗 The frontend lives in a separate repository: artisan_hub
artisan_hub_backend/
├── .github/
│ └── workflows/
│ └── ci.yml # Backend CI Pipeline
├── config/ # Configuration files (e.g., Database connection)
├── middleware/ # Global Express middlewares
├── modules/ # Domain-driven feature modules (Modular Structure)
│ ├── auth/ # Auth logic (routes, controller, model, etc.)
│ ├── payments/ # Payment logic (Stripe, Paymongo integration)
│ └── users/ # Users logic (routes, controller, model)
├── utils/ # Shared backend utility helper functions
├── .env.example # Example environment variables template
├── .gitignore # Git ignores
├── server.js # App entry point
├── package.json
└── package-lock.json
- Node.js:
v20.xor higher is recommended. - MongoDB: A running local MongoDB instance or a MongoDB Atlas URI.
- Install dependencies:
npm install
- Configure Environment Variables:
- Duplicate
.env.exampleand rename it to.env:cp .env.example .env
- Update the values inside
.envwith your actual MongoDB URI, port numbers, JWT secrets, Stripe keys, etc. (Note:.envis ignored by Git and should never be committed).
- Duplicate
- Start the server in development mode (with
nodemonauto-reload):The server should now be running onnpm run dev
http://localhost:5000(or your configuredPORT).
To maintain a clean history and streamline collaboration, please follow these guidelines:
Always create branches from dev (or main when working directly on hotfixes) using the following prefixes:
- Features:
feature/your-feature-name(e.g.feature/user-authentication) - Bug Fixes:
bugfix/issue-description(e.g.bugfix/avatar-crash-on-click) - Hotfixes (Urgent Prod Fixes):
hotfix/urgent-bug-name(e.g.hotfix/stripe-webhook-failing) - Documentation:
docs/what-changed(e.g.docs/update-readme) - Refactoring:
refactor/code-area(e.g.refactor/payment-routes)
We adhere to Semantic Commits to keep our logs readable. Format your messages like this:
type: description
feat: A new feature (e.g.,feat: integrate stripe payment intent API)fix: A bug fix (e.g.,fix: resolve jwt expiration crash on middleware)docs: Documentation changes only (e.g.,docs: add setup instructions to readme)style: Changes that do not affect the meaning of the code (formatting, white-space, missing semi-colons, etc.)refactor: A code change that neither fixes a bug nor adds a featureperf: A code change that improves performancetest: Adding missing tests or correcting existing testschore: Changes to the build process, auxiliary tools, or library dependencies (e.g.,chore: add gitkeep to empty folders)
The project uses GitHub Actions for quality assurance.
Every time you push code to main, dev, or feature/** branches, or open a pull request to main or dev, the pipeline will automatically:
- Syntax Check: Runs
node --check server.jsto prevent compile-time crashes from being merged.
Please resolve any issues locally before pushing to remote branches.
artisan_hub_backend/
├── config/ # Database and service configs
├── middleware/ # Express middleware (auth, error handling, etc.)
├── modules/ # Feature modules (users, auth, payments, etc.)
│ ├── users/
│ ├── auth/
│ └── payments/
├── utils/ # Shared utility helpers
├── server.js # App entry point
└── .env.example # Environment variable template
| Method | Path | Description |
|---|---|---|
| GET | /api/health |
Health check |
| ... | /api/users |
User management |
See .env.example for all required variables.