Skip to content

GachaMerch/GachaMerch-BE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GachaMerch Backend

REST API backend for GachaMerch a Genshin Impact-themed weapon merchandise platform where users can browse, purchase, and manage weapon collections using in-game coins.

Tech Stack

  • Runtime: Node.js + TypeScript
  • Framework: Express.js v5
  • Database: PostgreSQL + Prisma ORM
  • Auth: JWT + Google OAuth
  • Validation: Joi
  • Docs: Swagger UI (/api/docs)

Getting Started

Prerequisites

  • Node.js >= 18
  • PostgreSQL database
  • Google OAuth credentials (for Google login)

Installation

npm install

Environment Variables

Create a .env file:

DATABASE_URL=postgresql://user:password@localhost:5432/gachamerch
JWT_SECRET=your_jwt_secret
GOOGLE_CLIENT_ID=your_google_client_id

Database Setup

npx prisma migrate dev
npm run prisma:seed

Running

# Development
npm run dev

# Production
npm run build
npm start

API Endpoints

Method Endpoint Auth Description
POST /api/auth/register - Register with email & password
POST /api/auth/login - Login with email/username
POST /api/auth/google - Login with Google
GET /api/auth/me JWT Get current user
PATCH /api/auth/profile JWT Update username/password
GET /api/weapons - List weapons (paginated)
POST /api/weapons Admin Create weapon
PUT /api/weapons/:id Admin Update weapon
DELETE /api/weapons/:id Admin Delete weapon
GET /api/shop - Browse shop
POST /api/order/buy JWT Purchase weapon with coins
GET /api/inventory JWT View owned weapons
GET /api/notifications - Get notifications

Full API documentation available at /api/docs (Swagger UI).

Project Structure

src/
β”œβ”€β”€ controllers/    # Route handlers
β”œβ”€β”€ middlewares/    # Auth, validation, etc.
β”œβ”€β”€ routes/         # Express routers
β”œβ”€β”€ services/       # Business logic
└── index.ts        # App entry point
prisma/
β”œβ”€β”€ schema.prisma   # DB schema
└── seed.ts         # Seed data
assets/
└── data/           # Weapon data (JSON)

About

Backend GachaMerch 😊

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors