Backend services powering the Opal Labs productivity platform.
This is a public copy of a private repository where I collaborated with a team of 7 developers to build a Notion-like productivity platform.
This repository contains the backend services for the application.
For the frontend implementation, visit π Opal Labs Frontend
- Language: Go
- Database: PostgreSQL
- Caching: Redis
- Authentication: Google OAuth 2.0
- Testing: Go testing framework
- Methodology: Agile
The .env.example file contains a template for configuration.
cp .env.example .envTo enable hot-reload during development, install CompileDaemon:
π¦ https://pkg.go.dev/github.com/githubnemo/compiledaemon
-
Download PostgreSQL: π https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
-
During setup:
- Set password to:
password - Leave all other options as default
- Set password to:
-
Open pgAdmin4 and create a database named:
Website
If you prefer not to run PostgreSQL locally:
-
Create an account: π https://customer.elephantsql.com/login
-
Click Create New Instance
-
Select plan: Tiny Turtle (Free)
Update the following values in your .env file:
DB_USER="<User & Default Database>"
DB_PASSWORD="<Password>"
DB_NAME="<User & Default Database>"
DB_HOST="<Server>"
DB_PORT=5432
DB_SSL_MODE="disable"-
Download Redis: π https://redis.io/download
-
Ensure Redis is running on:
localhost:6379 -
Defaults (already set in
.env.example):- Password:
""(empty) - Database:
0
- Password:
If your setup differs, update:
REDIS_ADDR
REDIS_PASSWORD
REDIS_DB-
Create an account: π https://redislabs.com/
-
Create a free Redis database
Update your .env file:
REDIS_ADDR="<Public Endpoint>"
REDIS_PASSWORD="<Default User Password>"
REDIS_DB=0βΉοΈ These values can be found under the Configuration tab in RedisLabs.
-
The backend will still run without Redis, but caching will be disabled.
-
Start local Redis:
redis-server
-
Stop Redis:
redis-cli shutdown
SET key valueGET keyDEL keyFLUSHALL
Follow the setup instructions provided in the team drive:
π https://drive.google.com/drive/folders/1PWzpsJGXIDA_RnRRoEcJe_U5yvGC6s_U?usp=sharing
go build
go run .CompileDaemon -command="./backend"With the server running, open another terminal:
cd tests
go test -vRun a specific test:
go test -run "test_function_name"Replace:
localhost:8000
With:
https://opal-labs-backend-muej.onrender.com
https://opal-labs-backend-muej.onrender.com/page-get/123
Contributions are welcome!
- Open an issue for bugs or feature requests
- Submit a PR for improvements
This project is licensed under the MIT License. See the LICENSE file for details.
