A habit tracking web application built with Go and PostgreSQL.
The application uses:
- Go's
net/httpfor routing - PostgreSQL with session-based authentication
- Server-side rendered HTML templates for homepage, login, sign-up and sign-in
- JavaScript for client interactions
Database connection details are configured via environment variables.
- For local development, use
sslmode=disable.
- PostgreSQL 16+
- Go 1.21+
-
Create PostgreSQL user and database:
# Connect as superuser (usually postgres) psql -U postgres # Create user and database CREATE USER epoch WITH PASSWORD 'epoch'; CREATE DATABASE epoch OWNER epoch; \q
-
Run schema migrations:
# Load the complete schema and sample data psql -U epoch -d epoch -f schema.sql
-
Set environment variables:
export DB_HOST=localhost export DB_PORT=5432 export DB_USER=epoch export DB_PASSWORD=epoch export DB_NAME=epoch export DB_SSLMODE=disable
-
Start the application:
go run cmd/web/main.go
The app runs on port 8080 by default. Access it at: http://localhost:8080
To use a different port:
go run cmd/web/main.go -port 3000
The schema includes two test users:
- Username:
noahPassword:pass - Username:
demoPassword:pass
docker build -t myapp .docker run -p 8080:8080 \
-e DB_HOST=127.0.0.1 \
-e DB_PORT=5432 \
-e DB_USER=epoch \
-e DB_PASSWORD=devpass \
-e DB_NAME=epoch \
myappdocker run --env-file .env -p 8080:8080 epochTo get started, sign up for a new account using your preferred credentials. If you’re running the development build, you may use a preconfigured test account instead.
Once logged in, create a new habit by selecting the “+” icon located in the top-right corner of the dashboard. You can name the habit, set a frequency, and begin tracking your progress immediately.
To record your daily progress or updates, click the “+” icon in the top-right corner of the Logs page. Each log entry will be associated with the corresponding habit for easy tracking.
If you encounter the following screen, it indicates an invalid username or password. Please verify your credentials and try logging in again.
Contributions are welcome!
To report issues, request features, or suggest improvements:
- Visit the Issues page.
- Provide a clear description and reproduction steps (if applicable).
- I’ll review and respond as soon as possible.
If you’d like to contribute code:
- Fork the repository
- Create a new branch (git checkout -b feature/your-feature-name)
- Commit and push your changes
- Open a pull request with a clear description of your update
MIT License You’re free to use, modify, and distribute this software with attribution. See the LICENSE file for details.
- Created and Maintained: Noah Alexander
- Logos and Branding: Rob Bos




