packages/*
packages/assets
- sharable assets (files and images).packages/atlas
- API SDK.packages/auth
- Server authentication and authorization module.packages/email
- Email templates.packages/headless
- React components logic that can be used in the web and mobile.packages/UI
- Components library.packages/models
- Database models.packages/utils
- Sharable pure javascript logic that can be use on web, server, and mobile.
apps/*
apps/blog
- LiteSpace blog.apps/dashboard
- LiteSpace admin dashboard.apps/mobile
- LiteSpace mobile app.apps/landing
- LiteSpace landing page.apps/web
- LiteSpace main web platform.
-
Install NVM (node version manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
-
Configure NVM
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
-
Verify NVM installation by running
nvm -v
. You should see no errors. -
Install the current project node version.
# from the project root nvm install
-
Use the project node version.
nvm use
Enable pnpm
corepack enable pnpm
-
Run docker compose
# from services/server/ sudo docker compose up -d
note: if you want to remove the containers and flush the data use
sudo docker compose down
-
Setup your environment variables
# from services/server cp .env.example .env
Make changes if needed.
-
Setup database
-
Setup environment variables to be able to apply the database migrations.
# from packages/models/ cp .env.example .env
-
Apply the migrations by running
pnpm migrate up
frompackages/models/
-
To undo the migrations run
pnpm migrate down
-
Verify pnpm installation by running pnpm -v
. You should see no errors.
Follow the instractions on how to install Docker on Ubuntu (recommended but feel free to use any linux distro)
As Litespace is a monorepo and a large-scale project, organizing its logic is essential to maintain scalability and avoid complexity. To achieve this, we use packages, which group related logic for specific purposes. All packages are located under /packages/*
.
Package | Purpose |
---|---|
assets | Contains all SVGs used across the project. |
atlas | Centralized API SDK using axios to send requests to the backend. |
auth | Authentication management library. |
emails | Logic for sending emails via nodemailer and email templates. |
headless | Custom React hooks for shared functionality. |
kafka | Inter-service communication logic for backend services using kafka. |
models | Database models and interaction logic with the database. |
radio | Implementation of WhatsApp and Telegram clients for notifications. |
types | Centralized location for TypeScript types. |
ui | Reusable UI components with Storybook integration for documentation. |
utils | Shared utility functions and logic. |
To create a new package, follow these steps:
-
Initialize the Package:
- Run
pnpm init
in the package folder to generate apackage.json
. - Add the package to the root
package.json
workspace configuration and include it in thebuild:pkgs
script (example).
- Run
-
Install Dependencies:
- Be cautious when installing dependencies like
typescript
,dayjs
, orzod
. Copy their versions from existing packages to ensure consistency across the monorepo.
- Be cautious when installing dependencies like
-
Configure Scripts:
- Include the following scripts in the
package.json
:If a script is unused, it can remain empty ("scripts": { "build": "...", "check": "...", "clean": "...", "watch": "...", "prepare": "...", "test": "..." }
"script-name": ""
).
- Include the following scripts in the
-
Set Up TypeScript:
- Create a
tsconfig.json
file. You may need multiple configurations for different environments (e.g., ESM for web, CJS for Node.js) (example) - Use
typescript-transform-paths
to enable absolute imports (example ts file).
- Create a
-
Test Your Setup:
- Verify that your package builds correctly and integrates with the rest of the monorepo.
Note: Always ensure dependency versions match across packages to avoid compatibility issues.
Process | Location | Port |
---|---|---|
Web interface (vite) | apps/web | 3000 |
Dashboard (vite) | apps/dashboard | 3001 |
Web storybook (vite) | apps/web | 3002 |
UI storybook (vite) | packages/ui | 3003 |
Landing (next) | apps/landing | 3004 |
Emails | packages/emails | 3005 |
API server | services/server | 4000 |
Peer server | services/server | 4001 |
Messenger | services/messenger | 4002 |
Deployer | services/deployer | 4003 |
Echo | services/echo | 4004 |
Studio | services/studio | 4005 |
Jobs | services/jobs | N/A |
Kafka UI | System | 4006 |
PostgreSQL | System | 5432 |
Redis | System | 6379 |
Kafka | System | 9092 |
- ✅ : Compatible
- ⛔ : Not compatible
- ❔ : Not tested
Chrome | Firefox/Zen | Safari | Chrome Mobile | Brave | |
---|---|---|---|---|---|
Chrome | ✅ | ✅ | ✅ | ❔ | ✅ |
Firefox | ✅ | ✅ | ✅ | ❔ | ✅ |
Safari | ❔ | ❔ | ✅ | ❔ | ❔ |
Chrome Mobile | ❔ | ❔ | ❔ | ✅ | ❔ |
Brave | ❔ | ❔ | ❔ | ❔ | ❔ |