Skip to content

Diksha02/nodejs-chat-app-with-socket.io

Repository files navigation

Daily Dev Workflow

1) Start Services

docker compose up -d
docker compose ps

This brings up app and Postgres consistently.

2) Run App in Dev Mode (Hot Reload)

Pick one style and stick to it:

Host Dev (recommended for speed)

npm run dev
  • .env should use a localhost DB URL.

Container Dev (more parity)

  • Run the app inside the container.
  • DATABASE_URL in compose.yaml should use db.

3) Make Schema/Model Changes (when needed)

  1. Edit prisma/schema.prisma
  2. Run migration
  3. Generate Prisma client
  4. Inspect in Studio
npx prisma migrate dev --name <clear_name>
npx prisma generate
npx prisma studio

4) Build Features in Small Vertical Slices

For this chat app:

  1. DB write path first
  2. Socket emit second
  3. UI update third
  4. Test manually with 2 browser tabs

5) Validate Before Commit

  • Check app starts cleanly
  • Test one happy path and one edge case
  • Ensure migrations are present in prisma/migrations/*
  • Commit code and migration together

DATABASE_URL Rule (Important)

  • Host commands (npm, npx prisma ... on PowerShell) -> localhost
  • In-container runtime (docker compose exec server ...) -> db

Keep this mental rule and you will avoid most environment bugs.

End-of-Day Routine

docker compose down
  • You can keep services running if preferred.
  • Optional weekly cleanup: docker system prune (careful).
  • Push your branch with migration files included.

About

A Node.js based chat app implemented using Socket.io

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors