Skip to content

Repository files navigation

Artisan Hub — Backend API

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


📁 Repository Structure

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

🚀 Getting Started

Prerequisites

  • Node.js: v20.x or higher is recommended.
  • MongoDB: A running local MongoDB instance or a MongoDB Atlas URI.

⚙️ Backend Setup (Node/Express)

  1. Install dependencies:
    npm install
  2. Configure Environment Variables:
    • Duplicate .env.example and rename it to .env:
      cp .env.example .env
    • Update the values inside .env with your actual MongoDB URI, port numbers, JWT secrets, Stripe keys, etc. (Note: .env is ignored by Git and should never be committed).
  3. Start the server in development mode (with nodemon auto-reload):
    npm run dev
    The server should now be running on http://localhost:5000 (or your configured PORT).

🌿 Git & Workflow Guidelines

To maintain a clean history and streamline collaboration, please follow these guidelines:

🌟 Branch Naming Conventions

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)

💬 Commit Message Naming Conventions

We adhere to Semantic Commits to keep our logs readable. Format your messages like this:

type: description

Common Types:

  • 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 feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • chore: Changes to the build process, auxiliary tools, or library dependencies (e.g., chore: add gitkeep to empty folders)

🛠️ CI/CD Pipeline

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.js to 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

API Endpoints

Method Path Description
GET /api/health Health check
... /api/users User management

Environment Variables

See .env.example for all required variables.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages