- Updated .env.example and .env files for backend and frontend with placeholder values. - Enhanced .gitignore to include additional files and directories. - Modified docker-compose.yml to change image names and improve service health checks. - Updated README.md and SETUP_THE_PROJECT.md for clearer setup instructions. - Added database initialization scripts and SQL files for structured database setup. - Updated frontend Dockerfile to use Node.js 22 and adjusted package.json scripts. - Improved error handling and logging in start scripts for better debugging. - Added reCAPTCHA support in the signup page with conditional loading based on environment variables.
3.3 KiB
Setting up development environment
Getting started with development is a breeze! Follow these steps and you'll be contributing in no time.
Requirements
- Node.js version v16 or newer - Node.js
- PostgreSQL version v15 or newer - PostgreSQL
- S3-compatible storage (like MinIO) for file storage
Prerequisites
$ npm install -g typescript(optional, but recommended)
Installation
Clone the repository:
git clone https://github.com/Worklenz/worklenz.git
cd worklenz
Frontend installation
-
Navigate to the frontend project directory:
cd worklenz-frontend -
Install dependencies:
npm install -
Run the frontend:
npm start -
Navigate to http://localhost:5173
Backend installation
-
Navigate to the backend project directory:
cd worklenz-backend -
Open your IDE:
Open the project directory in your preferred code editor or IDE like Visual Studio Code.
-
Configure Environment Variables:
- Create a copy of the
.env.examplefile and name it.env. - Update the required fields in
.envwith your specific configuration.
- Create a copy of the
-
Set up Database
- Create a new database named
worklenz_dbon your local PostgreSQL server. - Update the database connection details in your
.envfile. - Execute the SQL setup files in the correct order:
# From your PostgreSQL client or command line psql -U your_username -d worklenz_db -f database/sql/0_extensions.sql psql -U your_username -d worklenz_db -f database/sql/1_tables.sql psql -U your_username -d worklenz_db -f database/sql/indexes.sql psql -U your_username -d worklenz_db -f database/sql/4_functions.sql psql -U your_username -d worklenz_db -f database/sql/triggers.sql psql -U your_username -d worklenz_db -f database/sql/3_views.sql psql -U your_username -d worklenz_db -f database/sql/2_dml.sql psql -U your_username -d worklenz_db -f database/sql/5_database_user.sqlAlternatively, you can use the provided shell script:
# Make sure the script is executable chmod +x database/00-init-db.sh # Run the script (may need modifications for local execution) ./database/00-init-db.sh - Create a new database named
-
Install Dependencies:
npm install -
Run the Development Server:
npm run devThis starts the development server allowing you to work on the project.
-
Run the Production Server:
a. Build the project:
npm run buildThis will compile the TypeScript code into JavaScript for production use.
b. Start the production server:
npm start
Docker Setup (Alternative)
For an easier setup, you can use Docker and Docker Compose:
-
Make sure you have Docker and Docker Compose installed on your system.
-
From the root directory, run:
docker-compose up -d -
Access the application:
- Frontend: http://localhost:5000
- Backend API: http://localhost:3000
- MinIO Console: http://localhost:9001 (login with minioadmin/minioadmin)
-
To stop the services:
docker-compose down