Skip to content

kaungmyatshwe1397/social-app-api

Repository files navigation

Social App API

Backend API service for the Social App project.

This service provides authentication, user management, and post-related endpoints.
Built with Express, Prisma ORM, and JWT-based authentication.


🛠 Tech Stack

Runtime & Framework

  • Node.js
  • Express.js

Database & ORM

  • Prisma ORM
  • SQLite (Better-SQLite3 adapter)

Authentication & Security

  • bcrypt (password hashing)
  • JSON Web Token (JWT)

Environment & Utilities

  • dotenv
  • CORS

Development Tools

  • TypeScript
  • tsx (dev runtime)
  • Prisma CLI
  • Faker (database seeding)

📦 Features

  • User registration
  • User login
  • Password hashing with bcrypt
  • JWT token generation & verification
  • Protected routes
  • Database schema management with Prisma
  • Database seeding support
  • CORS-enabled API access

📁 Project Structure

social-app-api/ ├── prisma/ │ ├── schema.prisma │ └── seed.ts ├── index.ts ├── package.json └── .env


🚀 Getting Started

1. Clone repository

2. Install dependencies

  • npm install

3. Configure environment variables

  • Create a .env file:
  • DATABASE_URL="file:./dev.db"
  • JWT_SECRET=your_secret_key

4. Run database migration

  • npm prisma migrate dev

5. Seed database (optional)


🔐 Authentication Flow

  1. User registers → password hashed with bcrypt
  2. User logs in → JWT issued
  3. Client sends JWT in Authorization header
  4. Protected routes verify token before access

📌 Notes

  • Do not commit .env file
  • Ensure JWT_SECRET is strong in production
  • Replace SQLite with production DB if deploying

Frontend Repository

This backend connects to:

https://github.com/kaungmyatshwe1397/social-app-client

👤 Author

Kaung Myat Shwe
GitHub: https://github.com/kaungmyatshwe1397

About

Express + Prisma backend API with JWT authentication and SQLite database.

Topics

Resources

Stars

Watchers

Forks

Contributors