Showoff is a real-time messaging application that leverages modern technologies such as Node.js, Express, PostgreSQL, Redis, and Kafka. The application allows users to send messages, create channels, and manage user authentication through Google OAuth. It is designed to be scalable and efficient, utilizing a microservices architecture with a focus on performance and reliability.
- User authentication via Google OAuth
- Real-time messaging using WebSockets
- Channel creation and management
- Message storage in PostgreSQL
- Caching with Redis for improved performance
- Kafka for handling asynchronous message processing
- Node.js: JavaScript runtime for building the server-side application.
- Express: Web framework for Node.js to handle HTTP requests.
- PostgreSQL: Relational database for storing user and message data.
- Redis: In-memory data structure store for caching.
- Kafka: Distributed event streaming platform for handling real-time data feeds.
- Sequelize: ORM for interacting with the PostgreSQL database.
- Passport: Middleware for authentication.
Before you begin, ensure you have met the following requirements:
- Node.js (version 20 or higher)
- PostgreSQL (version 12 or higher)
- Redis (version 6 or higher)
- Docker (for running services like PostgreSQL and Kafka)
- Yarn or npm (for package management)
Follow these steps to set up the project locally:
-
Clone the Repository
git clone https://github.com/piyushpradhan/experiment-backend.git cd experiment-backend -
Install Dependencies
Use npm or yarn to install the required packages:
pnpm install
-
Set Up Environment Variables
Create a
.envfile in the root directory and add the following variables:DB_URL=postgresql://postgres:postgres@localhost:5433/showoff REDIS_URL=redis://localhost:6379 KAFKA_BROKERS=localhost:9092 GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret SESSION_KEY=your_session_key CORS_ORIGIN=http://localhost:3000
-
Run PostgreSQL and Redis
You can use Docker to run PostgreSQL and Redis:
docker-compose up -d
-
Run Migrations
To set up the database schema, run the following command:
npx sequelize-cli db:migrate
-
Start the Application
You can start the application in development mode using:
pnpm run dev