The Notification Center is a microservice designed to manage notifications for Giveth.io and other DApps. It provides a centralized system for handling various types of notifications across different platforms.
- Centralized notification management
- Support for multiple DApps
- RESTful API interface
- Real-time notification delivery
- Customizable notification settings
- Production: https://notification.giveth.io/
- Staging: https://notification.serve.giveth.io/
graph TD
A[Client Applications] --> B[Notification Center API]
B --> C[PostgreSQL Database]
B --> D[Redis Cache]
B --> E[External Services]
E --> G[Ortto Email Services]
- Runtime: Node.js v16
- Language: TypeScript v4.5.2
- Database: PostgreSQL v14.2
- ORM: TypeORM v0.3.6
- Caching: Redis v5.0.9
- API Framework: Express v4.17.3
- Containerization: Docker Compose v3.3
- Documentation: Swagger/OpenAPI
- Testing: Mocha v9.2.2
- CI/CD: GitHub Actions
- Client applications send notification requests to the API
- Requests are validated and processed through middleware
- Notifications are stored in PostgreSQL
- Real-time notifications are cached in Redis
- Notifications are delivered to appropriate users through Ortto API to send emails and manage tags
- Node.js v16 (use
nvm use
to load appropriate version) - Docker and Docker Compose
- PostgreSQL v14.2
- Redis v5.0.9
-
Clone the repository:
git clone [email protected]:Giveth/notification-center.git cd notification-center
-
Install dependencies:
yarn i
-
Set up the development environment:
docker-compose -f docker-compose-local-postgres-redis.yml up -d
-
Configure environment variables:
- Copy
config/example.env
toconfig/development.env
- Update the values in
development.env
as needed
- Copy
-
Run database migrations:
yarn run db:migrate:run:local
-
Start the development server:
yarn start
-
Access the API documentation at http://localhost:3040/docs
- Development:
yarn start
- Staging:
yarn run start:server:staging
- Production:
yarn run start:server:production
# Run all tests
yarn run test
# Run specific test files
yarn run test:notificationRepository
yarn run test:notificationSettingRepository
- Create new migration:
typeorm migration:create ./migrations/createNotificationTable
- Run migrations:
yarn run db:migrate:run:local
- Revert last migration:
yarn run db:migrate:revert:local
- Development: Local development environment
- Staging: Pre-production testing environment
- Production: Live production environment
-
Build the application:
yarn run build
-
Run database migrations:
yarn run db:migrate:run:production
-
Start the server:
yarn run start:server:production
The project uses GitHub Actions for continuous integration and deployment. The workflow is defined in .github/workflows/{main-staging}-pipeline.yml
.
-
Database Connection Issues
- Verify PostgreSQL is running
- Check environment variables
- Ensure migrations are up to date
-
Redis Connection Issues
- Verify Redis is running
- Check Redis configuration
- Ensure proper network connectivity
- Install bunyan for better log visualization:
yarn i -g bunyan
- View logs:
tail -f logs/notification-center.log | bunyan