Skip to content

HTN2025-stoc/stoc-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stoc Backend API

REST API server for the Stoc social feed sharing application.

Features

  • User authentication (JWT)
  • Feed post storage and retrieval
  • One-time sharing link generation
  • Subscription management
  • Rate limiting and security middleware
  • PostgreSQL database with Prisma ORM

Setup

  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your database credentials and JWT secret
  1. Set up the database:
npm run db:generate
npm run db:migrate
  1. Start development server:
npm run dev

API Endpoints

Authentication

  • POST /auth/register - Create new user account
  • POST /auth/login - User login

Feeds

  • GET /feeds/posts - Get user's feed posts
  • GET /feeds/posts/:userId - Get specific user's feed posts
  • POST /feeds/posts - Save new feed post

Sharing

  • POST /sharing/create - Create one-time sharing link
  • POST /sharing/redeem - Redeem sharing link and subscribe

Subscriptions

  • GET /subscriptions - Get user's subscriptions
  • DELETE /subscriptions/:id - Unsubscribe from user

Database Schema

See prisma/schema.prisma for the complete database schema.

Development

  • npm run dev - Start development server with hot reload
  • npm run build - Build for production
  • npm run db:studio - Open Prisma Studio for database management

About

api and db

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •