Skip to content

MuhammetEmreNumanoglu/NeonAppsBackend

Repository files navigation

NeonAppsBackend

A NestJS backend project providing user, friendship, notification, todo and real-time chat (Socket.IO) features. It uses Prisma ORM and integrates Redis for caching and real-time adapters.

Technologies: Node.js, TypeScript, NestJS, Prisma, PostgreSQL, Redis, Socket.IO, BullMQ

Status: Development (local). Fill in .env values before pushing to GitHub or deploying.

Overview

  • API: REST + WebSocket (chat gateway)
  • Auth: JWT + Google OAuth
  • Persistence: Prisma + PostgreSQL (see prisma/migrations)

Quick Start

  1. Clone the repo and install dependencies:
pnpm install
  1. Create a .env file and set the following environment variables (validation is defined in src/common/configs/env.config.ts):
  • NODE_ENV (development|production|test)
  • PORT (e.g. 8080)
  • DATABASE_URL (Postgres connection URL)
  • JWT_SECRET
  • JWT_EXPIRES_IN (e.g. 7d)
  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • GOOGLE_CALLBACK_URL
  • MAIL_USER (SMTP user/email)
  • MAIL_PASS (SMTP password)
  • FRONTEND_URL (frontend origin)
  • REDIS_URL (optional)

Example .env (replace values with your own secrets):

NODE_ENV=development
PORT=8080
DATABASE_URL=postgresql://user:pass@localhost:5432/neon_db
JWT_SECRET=your_jwt_secret
JWT_EXPIRES_IN=7d
GOOGLE_CLIENT_ID=xxx
GOOGLE_CLIENT_SECRET=yyy
GOOGLE_CALLBACK_URL=http://localhost:3000/api/auth/google/callback
MAIL_USER=[email protected]
MAIL_PASS=mailpassword
FRONTEND_URL=http://localhost:5173
REDIS_URL=redis://localhost:6379
  1. Generate Prisma client and apply migrations (development):
npx prisma generate
npx prisma migrate dev --name init

To apply migrations in production:

npx prisma migrate deploy
  1. Start the development server:
pnpm run start:dev
  1. (Optional) Run the admin seed script:
npx ts-node -r tsconfig-paths/register src/seed-admin.ts

Scripts / Common Commands

  • Build: pnpm run build
  • Start (production): pnpm run start:prod
  • Unit tests: pnpm run test — E2E: pnpm run test:e2e
  • Lint & format: pnpm run lint, pnpm run format

Database & Migration Notes

  • Prisma schema: prisma/schema.prisma
  • Migrations: prisma/migrations
  • To add a new migration use: npx prisma migrate dev --name <desc>

Docker

  • The project includes a Dockerfile. Example build/run:
docker build -t neonapps-backend .
docker run -e DATABASE_URL="$DATABASE_URL" -p 8080:8080 neonapps-backend

Note: For production, run prisma migrate deploy and provide proper environment variables.

Important Directories

  • src/ — application source code
  • src/modules — domain modules (auth, chat, user, todo, notification, friendship...)
  • src/core/database — Prisma service and DB setup
  • prisma/ — schema and migrations

Common Issues

  • Environment validation failed: You likely missed required .env variables. Check src/common/configs/env.config.ts for required keys.
  • Redis/Socket.IO: ensure REDIS_URL is correctly set for adapter and cache.

Contributing

  1. Fork → create a feature branch
  2. Add changes and run tests locally
  3. Open a pull request with a descriptive title and summary

License & Copyright

  • The repository currently lists UNLICENSED in package.json. If you plan to publish this on GitHub, add an appropriate license file if needed.

-- README updated. If you want, I can commit and push the change to your Git remote.

Common Issues

  • Environment validation failed: You likely missed required .env variables. Check src/common/configs/env.config.ts for required keys.
  • Redis/Socket.IO: ensure REDIS_URL is correctly set for adapter and cache.

Contributing

  1. Fork → create a feature branch
  2. Add changes and run tests locally
  3. Open a pull request with a descriptive title and summary

License & Copyright

  • The repository currently lists UNLICENSED in package.json. If you plan to publish this on GitHub, add an appropriate license file if needed.

-- README updated. If you want, I can commit and push the change to your Git remote.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors