This guide will help you set up a complete development environment for OpenLN projects.
Before you begin, ensure you have the following installed on your system:
- Node.js (v18 or higher) - Download here
- npm (comes with Node.js) or yarn
- MongoDB (v6.0 or higher) - Installation guide
- Git - Download here
- VS Code with extensions:
- ES7+ React/Redux/React-Native snippets
- Prettier - Code formatter
- ESLint
- MongoDB for VS Code
- MongoDB Compass (GUI for MongoDB)
- Postman or Insomnia (API testing)
# Fork the repository on GitHub first, then clone your fork
git clone https://github.com/YOUR_USERNAME/Openln-Engine.git
cd Openln-Engine
# Add upstream remote
git remote add upstream https://github.com/Openln-git/Openln-Engine.gitThe project has separate client and server components:
# Install server dependencies
cd server
npm install
# Install client dependencies
cd ../client
npm install- Create a
.envfile in theserverdirectory:
cd server
cp .env.example .env # If example exists, otherwise create new- Configure your
.envfile with the following variables:
# Server Configuration
PORT=5000
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/openln-dev
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-here
JWT_EXPIRE=7d
# Google AI Configuration
GOOGLE_AI_API_KEY=your-google-ai-api-key
# OAuth Configuration (optional for local dev)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# CORS
CLIENT_URL=http://localhost:5173- Create a
.envfile in theclientdirectory:
cd client
touch .env- Configure your client
.envfile:
# API Configuration
VITE_API_URL=http://localhost:5000/api
VITE_SERVER_URL=http://localhost:5000
# Google AI (if using client-side AI features)
VITE_GOOGLE_AI_API_KEY=your-google-ai-api-key- Start MongoDB service:
# On macOS with Homebrew
brew services start mongodb-community
# On Ubuntu/Debian
sudo systemctl start mongod
# On Windows
# Start MongoDB service from Services or run mongod.exe- Create development database:
# Connect to MongoDB
mongosh
# Create and switch to development database
use openln-dev
# Create a test collection (optional)
db.users.insertOne({test: "data"})- Verify connection:
- Open MongoDB Compass
- Connect to
mongodb://localhost:27017 - You should see the
openln-devdatabase
If you prefer using MongoDB Atlas (cloud):
- Create account at MongoDB Atlas
- Create a free cluster
- Get connection string and update
MONGODB_URIin your.env
Terminal 1 - Start the server:
cd server
npm run devServer will start on http://localhost:5000
Terminal 2 - Start the client:
cd client
npm run devClient will start on http://localhost:5173
You can create a simple script to run both services:
Create dev-start.sh in the root directory:
#!/bin/bash
# Start both client and server concurrently
echo "Starting OpenLN Development Environment..."
# Start server in background
cd server && npm run dev &
SERVER_PID=$!
# Start client in background
cd ../client && npm run dev &
CLIENT_PID=$!
# Function to clean up processes
cleanup() {
echo "Shutting down..."
kill $SERVER_PID $CLIENT_PID
exit
}
# Handle interruption
trap cleanup INT TERM
# Wait for both processes
wait $SERVER_PID $CLIENT_PIDMake it executable and run:
chmod +x dev-start.sh
./dev-start.shOpen http://localhost:5000/api/health in your browser or run:
curl http://localhost:5000/api/healthOpen http://localhost:5173 in your browser
Look for database connection messages in the server terminal output.
# Run ESLint on client code
cd client
npm run lint
# Run ESLint with auto-fix
npm run lint:fix# Build client for production
cd client
npm run build
# Preview production build
npm run preview# Find and kill process using port 5000
lsof -ti:5000 | xargs kill -9
# Or use a different port in your .env file- Ensure MongoDB service is running
- Check connection string in
.env - Verify network connectivity for Atlas
# Check Node version
node --version
# Use Node Version Manager if needed
nvm install 18
nvm use 18# Fix npm permissions
sudo chown -R $(whoami) ~/.npmOnce your development environment is set up:
- Read the Architecture Overview
- Check out the Contributing Guidelines
- Explore the API Reference
- Look for good first issues
- Use
npm run devfor hot-reloading during development - Install the React Developer Tools browser extension
- Use MongoDB Compass for database visualization
- Set up GitHub CLI for easier contribution workflow
- Configure your IDE with ESLint and Prettier for consistent code formatting
Need help? Open an issue or start a discussion!