This is the backend service for Devsphere, built with TypeScript, Express, and Prisma. This RESTful API poweres the DevSphere community platform with features like:
- User Authentication & Authorization - Secure JWT-based authentication with role-based access control
- Project Management - Complete CRUD operations for community projects with GitHub integration
- Event Management - Create, manage, and track community events and activities
- Automated Contributor Sync - Daily cron jobs to automatically fetch and sync GitHub contributors
- Member Management - Comprehensive team member profiles and role assignments
- File Upload Support - Cloudinary integration for seamless image and file uploads
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher)
- npm (v8 or higher)
- PostgreSQL (v13 or higher)
- Git
The following documents provide visual diagrams and workflow explanations for key backend processes:
git clone {your-forked-repo-url}
cd devsphere-backendnpm installCreate a .env file in the root directory and add the following variables:
cp .env.example .envThis project uses PostgreSQL with Prisma.
-
Make sure you have a PostgreSQL database set up.
-
Run migrations to set up the database schema:
npx prisma migrate deploy- Generate the Prisma client:
npx prisma generate- Seed the database with initial data:
npm run prisma.seed- Start the development server:
npm run devThe API is running at http://localhost:3000.
Note: If you make ANY changes to the Prisma schema files (in prisma/schema/), you MUST migrate the changes to the database:
npx prisma migrate dev --name <migration_name>This includes:
- Adding new models/tables
- Modifying existing fields
- Adding/removing relationships
- Changing field types
- Adding/removing indexes
Please see the CONTRIBUTING.md file for detailed guidelines on how to contribute to this project.
npx vitest src/tests/events/create.test.ts: target a particular filenpm run test: test all
Make sure u have docker and act installed
- mock the push using
act pushONLY USE THIS COMMAND FOR FIRST TIME - now check if the images are installed on docker
docker images - now everytime u call use
act push --reuseso instead of creating new image it uses the existing image