Skip to content

GregoryKogan/admissions-prototype

Repository files navigation

admissions

This is an early prototype of an admissions system for the L2SH (Лицей "Вторая школа") school.

The system is built with Go (Echo framework) and Vue.js. It uses Redis for caching and PostgreSQL for the database. A React Admin panel is provided for administration and API for it is built with PostgREST.

ToC

🗂️ Project structure

  • cmd/ - application entry points
  • internal/ - internal packages
  • ui/ - frontend
  • tests/ - tests
  • admin-panel/ - React Admin panel
  • config.yml - configuration

🚀 Build and run

Before running the application, make sure to set the required environment variables secrets.

🌱 Development

docker compose up --build --watch
  • --watch - update the container on code changes

🛠️ Production

docker compose up --build

🔌 Ports

Default ports:

  • server - 8888 (set in config.yml)
  • admin-panel - 4444
  • ui - 3000 (Vite development server)
  • pgadmin - 5050
  • database - 5432

Secrets

Secrets are loaded from environment variables.
Set the following variables before running the application:

  • DB_PASSWORD - password for the database
  • JWT_KEY - secret key for JWT signing
  • MAIL_API_KEY - NotiSend API key
  • ADMIN_PASSWORD - password for the default admin user

🔒 Authentication

This project features a robust JWT-based authentication system with automatic token rotation for every login or refresh, ensuring users are seamlessly re-authenticated without manual re-login. Each token is stored in Redis for quick invalidation, allowing flexible auto-logout and enhanced session control.

Passwords are secured using Argon2 with distinct, randomly generated salts, providing state-of-the-art security against brute force attacks. User-friendly password guidelines (minimum length, mixed case, digits, and special characters) further strengthen credentials and reduce the risk of weak passwords.

✉️ Email sending with NotiSend

This service uses NotiSend for email verification and other automated notifications. It calls a NotiSend API endpoint in the “mailing” package using an API key secured in environment variables. This approach removes SMTP complexity and lets NotiSend handle delivery. Email can be disabled locally by setting “mailing.enabled” to false in config.yml or mocking the calls.

🛎️ Administration

📈 Logging

The application logs to stdout, which can be viewed with docker logs command.

docker logs admissions

🌐 PgAdmin

Credentials to connect to the development database are in docker-compose.yml and DB_PASSWORD secret.

🎨 Admin Panel

The admin panel is a separate frontend built with PostgREST and React Admin. A Docker service is provided in the docker-compose.yml under the "admin-panel" service. It can be accessed at http://localhost:4444 once the container is running.

🧪 Testing

✅ Run tests

go test -v ./...

Code coverage

go test -v -coverprofile=coverage.out ./...

coverage.out file will be generated in the project root directory.
To view the coverage report, run:

go tool cover -html=coverage.out