Skip to content

Commit 9ccdcd7

Browse files
Merge pull request #50 from Golden-Eagle07/15-write-comprehensive-readme
updated readme
2 parents ecdae19 + 723c5f4 commit 9ccdcd7

1 file changed

Lines changed: 89 additions & 34 deletions

File tree

README.md

Lines changed: 89 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,69 @@
1+
[![GitHub Release](https://img.shields.io/github/v/release/commandlinecoding/elephant?style=flat-square&color=blue)](https://github.com/commandlinecoding/elephant/releases)
2+
[![Docker Pulls (Docker Hub)](https://img.shields.io/docker/pulls/commandlinecoding/elephant?style=flat-square&logo=docker)](https://hub.docker.com/r/commandlinecoding/elephant)
3+
[![Go Integration & Test Suite](https://github.com/commandlinecoding/elephant/actions/workflows/backend.yaml/badge.svg)](https://github.com/commandlinecoding/elephant/actions)
4+
[![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL-green.svg?style=flat-square)](LICENSE)
5+
6+
---
7+
18
# Elephant
29
Elephant – a privacy-first, open-source messaging application made with Go and Flutter. Elephant supports secure authentication, user discovery, and real-time chat over WebSocket, with all communication TLS-protected between client and server.
310

11+
<img src="./mobile/assets/launcher/elephant.png" width="200" height="200" alt="App Screenshot">
12+
13+
## Tech Stack
14+
15+
| Layer | Technology |
16+
|---|---|
17+
| Backend | Go (chi, pgx, gorilla/websocket, golang-jwt, argon2) |
18+
| Mobile | Flutter (http, web_socket_channel, provider, sqflite) |
19+
| Database | PostgreSQL 16 |
20+
| CI/CD | GitHub Actions, Docker Compose, GHCR |
21+
22+
## GitHub Releases (Mobile Apps)
23+
24+
If you just want to run the client application or get a production-ready backend binary without setting up a build environment, head straight over to our **[GitHub Releases Page](https://github.com/commandlinecoding/elephant/releases)**.
25+
26+
Here you will find:
27+
* **Client Installers:** Pre-built application packages (`.apk` for Android ) ready for deployment.
28+
---
29+
430
## Quick Start (Docker/Podman)
531

632
The fastest way to run Elephant is by pulling the published image — no Go toolchain required.
733

34+
#### Pulling image from Docker Hub
835
```bash
9-
# Log in to GitHub Container Registry
10-
docker login ghcr.io -u YOUR_GITHUB_USERNAME
11-
# or: podman login ghcr.io -u YOUR_GITHUB_USERNAME
12-
13-
# Clone the repo for the compose file and .env template
14-
git clone https://github.com/commandlinecoding/elephant.git
15-
cd elephant
16-
17-
# Copy and fill in environment variables
18-
cp .env.example .env
19-
20-
# Start the stack
21-
docker compose up
22-
# or: podman-compose up
36+
docker run --name elephant-server \
37+
-e PORT=8080 \
38+
-e POSTGRES_HOST=host.docker.internal \
39+
-e POSTGRES_PORT=5432 \
40+
-e POSTGRES_USER=your_db_user \
41+
-e POSTGRES_PASSWORD=your_db_password \
42+
-e POSTGRES_DB=your_db_name \
43+
-e JWT_SECRET=a_secure_32_character_secret_key_phrase \
44+
-p 8080:8080 \
45+
-d commandlinecoding/elephant:latest
46+
```
47+
48+
#### Pulling image from Github GHCR
49+
```bash
50+
podman run --name elephant-server \
51+
-e PORT=8080 \
52+
-e POSTGRES_HOST=host.containers.internal \
53+
-e POSTGRES_PORT=5432 \
54+
-e POSTGRES_USER=your_db_user \
55+
-e POSTGRES_PASSWORD=your_db_password \
56+
-e POSTGRES_DB=your_db_name \
57+
-e JWT_SECRET=a_secure_32_character_secret_key_phrase \
58+
-p 8080:8080 \
59+
-d ghcr.io/commandlinecoding/elephant:latest
2360
```
61+
62+
2463
Once running, verify the server is healthy:
25-
64+
2665
```bash
27-
curl http://localhost:8080/api/health
66+
curl http://HOST:PORT/api/health
2867
```
2968

3069
You should see:
@@ -33,21 +72,22 @@ You should see:
3372
{"success":true,"data":{"postgres":"up","timestamp":"..."}}
3473
```
3574

36-
## Tech Stack
37-
38-
| Layer | Technology |
39-
|---|---|
40-
| Backend | Go (chi, pgx, gorilla/websocket, golang-jwt, argon2) |
41-
| Mobile | Flutter (http, web_socket_channel, provider, sqflite) |
42-
| Database | PostgreSQL 16 |
43-
| CI/CD | GitHub Actions, Docker Compose, GHCR |
44-
4575
## Local Development Setup
4676

4777
If you're contributing to the backend and want to build from source instead of pulling the published image, use the dev compose override:
48-
78+
79+
4980
```bash
50-
docker compose -f compose.yaml -f compose.dev.yaml up
81+
# Clone the repo for the compose file and .env template
82+
git clone https://github.com/commandlinecoding/elephant.git
83+
cd elephant
84+
85+
# Copy and fill in environment variables
86+
cp .env.example .env
87+
88+
# Start the stack
89+
docker compose up -d
90+
# or: podman-compose up -d
5191
```
5292

5393
This builds the `server` image from `server/Dockerfile` on every run instead of pulling from GHCR, so your local changes are reflected immediately.
@@ -67,10 +107,20 @@ Make sure PostgreSQL is running and reachable using the values in your `.env` fi
67107
```bash
68108
cd server
69109
psql "postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB" \
70-
-f migrations/001_create_users_up.sql \
71-
-f migrations/002_create_refresh_tokens_up.sql \
72-
-f migrations/003_add_search_indexes_up.sql \
73-
-f migrations/004_create_message_up.sql
110+
for migration in /app/migrations/*_up.sql; do
111+
filename=$(basename "$migration")
112+
already_applied=$(psql "${DB_URL}" -tAc \
113+
"SELECT COUNT(*) FROM schema_migrations WHERE filename = '${filename}'")
114+
if [ "$already_applied" = "0" ]; then
115+
echo "Applying ${filename}..."
116+
psql "${DB_URL}" -f "$migration"
117+
psql "${DB_URL}" -c \
118+
"INSERT INTO schema_migrations (filename) VALUES ('${filename}')"
119+
echo "${filename} applied."
120+
else
121+
echo "${filename} already applied, skipping."
122+
fi
123+
done
74124
```
75125

76126
### Running the mobile app
@@ -121,12 +171,13 @@ go test -v ./...
121171
Integration tests under [server/tests/](server/tests/) expect a running server and database. Start the stack first, then run:
122172

123173
```bash
124-
HOST=localhost PORT=8080 go test -v ./tests/...
174+
HOST=$HOST PORT=$PORT go test -v ./tests/...
125175
```
126176

127177
### CI/CD
128178

129-
Tests, `go vet`, and `staticcheck` run automatically on every push and pull request via GitHub Actions (`.github/workflows/`). Docker images are built and published to GHCR via manual `workflow_dispatch` or on tagged pushes.
179+
Docker images are built and published to both GHCR and Docker Hub automatically on every version tag push.
180+
Android APKs are built and attached to GitHub Releases automatically on every version tag push.
130181

131182
## Project Structure
132183

@@ -151,7 +202,7 @@ elephant/
151202
│ ├── models/ # Data models
152203
│ ├── repository/ # Database access layer
153204
│ ├── routes/ # Route definitions
154-
│ ├── services/ # Business logic (auth, users, JWT, WebSocket hub)
205+
│ ├── services/ # Business logic (auth, users, JWT, WebSocket)
155206
│ ├── tests/ # Integration tests
156207
│ └── Dockerfile
157208
├── compose.yaml # Default: pulls published image
@@ -160,6 +211,10 @@ elephant/
160211
└── LICENSE
161212
```
162213

214+
## Contributing
215+
216+
Checkout [CONTRIBUTING.md](CONTRIBUTING.md) for more information
217+
163218
## License
164219

165220
See [LICENSE](LICENSE) for details.

0 commit comments

Comments
 (0)