This project is a monorepo for an Email IMAP Client that fetches emails and loads them into Elasticsearch.
- Prerequisites
- Installation
- Environment Variables
- Docker Setup
- Running the Project
- Building the Project
- Node.js (v14 or later)
- npm (v6 or later)
- Docker (v20 or later)
- Docker Compose (v1.27 or later)
- Azure Portal Registered App
- Clone the repository:
git clone https://github.com/yourusername/email-imap-client.git
cd email-imap-client
- Install dependencies:
npm install
npm install --prefix backend
npm install --prefix packages/shared-types
npm install --prefix frontend
Create a .env
file in the root directory and configure the following environment variables:
This file is for docker-compose
POSTGRES_USER=your_postgres_user
POSTGRES_PASSWORD=your_postgres_password
POSTGRES_DB=your_database
POSTGRES_PORT=5432
REDIS_PASSWORD=your_redis_password
ELASTIC_USER=your_elastic_user
ELASTIC_PASS=your_elastic_Pass
docker-compose up -d
Run the script from script folder in the root elasticIndex.sh
to add the indices
Create a .env
file in the ./backend
directory and configure the following environment variables:
AUTH_SECRET=some_secret_text
POSTGRES_USER= dbuser
POSTGRES_PASSWORD= dbpass
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB= emaildb
REDIS_PASSWORD= redispass
ELASTIC_NODE= http://localhost:9200
ELASTIC_USER= elastic
ELASTIC_PASS= elasticPass
CLIENT_ID=your_app_client_id
REDIRECT_URI=http://localhost:5173/emailLink (This must be same from the app registration)
CLIENT_SECRET=your_secret
Create a .env
file in the ./frontend
directory and configure the following environment variables:
VITE_API_BASE_URL=http://localhost:5000/api/v1
To run the backend:
cd backend
npm run dev
To run the frontend:
cd frontend
npm run dev
- Build shared-types:
cd packages/shared-types
npm run build
- Build the backend:
cd backend
npm run build
- Build the frontend:
cd frontend
npm run build
- Ensure that the symlinks for
shared-types
are properly created in thenode_modules
folder. - If you encounter issues with imports, verify that the
tsconfig.json
andvite.config.js
files are correctly configured.
This README should provide a clear guide for setting up and running your project. Let me know if you need any further adjustments or additional information!