https://github.com/abduldevhub/opal-labs-backend
This is a public and enhanced copy of a private repository in which I worked with a team of 7 people to create a Notion-like productivity website. The project is built using Next.js, TypeScript, Google OAuth, the Agile Model, PostgreSQL, Redis, Playwright, and Go.
https://github.com/abduldevhub/opal-labs-backend
elephantsql go postgresql postman redis render rest-api sql
Last synced: 3 months ago
JSON representation
This is a public and enhanced copy of a private repository in which I worked with a team of 7 people to create a Notion-like productivity website. The project is built using Next.js, TypeScript, Google OAuth, the Agile Model, PostgreSQL, Redis, Playwright, and Go.
- Host: GitHub
- URL: https://github.com/abduldevhub/opal-labs-backend
- Owner: AbdulDevHub
- License: mit
- Created: 2024-03-27T06:26:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-07T22:48:02.000Z (almost 2 years ago)
- Last Synced: 2026-01-03T16:23:49.973Z (6 months ago)
- Topics: elephantsql, go, postgresql, postman, redis, render, rest-api, sql
- Language: Go
- Homepage: https://opal-labs-backend-muej.onrender.com/
- Size: 113 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# ๐ง Opal Labs โ Backend
Backend services powering the Opal Labs productivity platform.

[๐ฅ Frontend Repository](https://github.com/AbdulDevHub/Opal-Labs-Frontend)





---
## โจ Introduction
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](https://github.com/AbdulDevHub/Opal-Labs-Frontend)**
### ๐งฑ Backend Tech Stack
- **Language:** Go
- **Database:** PostgreSQL
- **Caching:** Redis
- **Authentication:** Google OAuth 2.0
- **Testing:** Go testing framework
- **Methodology:** Agile
---
## ๐ Setup
### ๐ Environment Variables
The `.env.example` file contains a template for configuration.
```bash
cp .env.example .env
````
---
### ๐ CompileDaemon (Hot Reload)
To enable hot-reload during development, install **CompileDaemon**:
๐ฆ [https://pkg.go.dev/github.com/githubnemo/compiledaemon](https://pkg.go.dev/github.com/githubnemo/compiledaemon)
---
## ๐ PostgreSQL Setup
### Local Installation
1. Download PostgreSQL:
๐ [https://www.enterprisedb.com/downloads/postgres-postgresql-downloads](https://www.enterprisedb.com/downloads/postgres-postgresql-downloads)
2. During setup:
- Set password to: `password`
- Leave all other options as default
3. Open **pgAdmin4** and create a database named:
```text
Website
```
---
### โ๏ธ ElephantSQL (Hosted Option)
If you prefer not to run PostgreSQL locally:
1. Create an account:
๐ [https://customer.elephantsql.com/login](https://customer.elephantsql.com/login)
2. Click **Create New Instance**
3. Select plan: **Tiny Turtle (Free)**
Update the following values in your `.env` file:
```bash
DB_USER=""
DB_PASSWORD=""
DB_NAME=""
DB_HOST=""
DB_PORT=5432
DB_SSL_MODE="disable"
```
---
## โก Redis Setup
### Local Installation
1. Download Redis:
๐ [https://redis.io/download](https://redis.io/download)
2. Ensure Redis is running on:
```text
localhost:6379
```
3. Defaults (already set in `.env.example`):
- Password: `""` (empty)
- Database: `0`
If your setup differs, update:
```env
REDIS_ADDR
REDIS_PASSWORD
REDIS_DB
```
---
### โ๏ธ Hosted Redis (RedisLabs)
1. Create an account:
๐ [https://redislabs.com/](https://redislabs.com/)
2. Create a **free** Redis database
Update your `.env` file:
```bash
REDIS_ADDR=""
REDIS_PASSWORD=""
REDIS_DB=0
```
โน๏ธ These values can be found under the **Configuration** tab in RedisLabs.
---
### ๐ฆ Redis Usage Notes
- The backend will still run **without Redis**, but caching will be disabled.
- Start local Redis:
```bash
redis-server
```
- Stop Redis:
```bash
redis-cli shutdown
```
#### Common Redis Commands
- `SET key value`
- `GET key`
- `DEL key`
- `FLUSHALL`
---
## ๐ Google OAuth 2.0
Follow the setup instructions provided in the team drive:
๐ [https://drive.google.com/drive/folders/1PWzpsJGXIDA_RnRRoEcJe_U5yvGC6s_U?usp=sharing](https://drive.google.com/drive/folders/1PWzpsJGXIDA_RnRRoEcJe_U5yvGC6s_U?usp=sharing)
---
## ๐ Running the Server
```bash
go build
go run .
```
### Hot Reload Mode
```bash
CompileDaemon -command="./backend"
```
---
## ๐งช Running Tests
With the server running, open another terminal:
```bash
cd tests
go test -v
```
Run a specific test:
```bash
go test -run "test_function_name"
```
---
## โ๏ธ Testing Hosted Backend
Replace:
```text
localhost:8000
```
With:
```text
https://opal-labs-backend-muej.onrender.com
```
### Example
```text
https://opal-labs-backend-muej.onrender.com/page-get/123
```
---
## ๐ค Contributing
Contributions are welcome!
- Open an issue for bugs or feature requests
- Submit a PR for improvements
---
## ๐ License
This project is licensed under the **MIT License**.
See the [LICENSE](LICENSE) file for details.