A robust REST API for managing employee attendance, organizations, shifts, and tasks. Built with Go, PostgreSQL, and Docker.
- Authentication: User registration and login with JWT-based authentication (Access & Refresh Tokens).
- User Management: View and update user profile, secure logout.
- Organization Management: Create organizations, invite employees, and manage roles (OWNER, MANAGER, EMPLOYEE). Owners and Managers can view, update, and remove employees.
- Shift & Group Management: Define shifts with specific working hours and assign users to groups.
- Attendance Tracking:
- General Check-in/out.
- Task-based Check-in (with optional geofencing).
- Late arrival detection.
- Reporting: Generate performance reports for groups.
- Swagger Documentation: Interactive API documentation.
- Language: Go (Golang)
- Framework: Chi
- Database: PostgreSQL
- Driver: pgx
- Authentication: JWT (JSON Web Tokens)
- Validation: go-playground/validator
- Documentation: Swagger
- Containerization: Docker & Docker Compose
git clone https://github.com/syst3mctl/check-in-api.git
cd check-in-apiCreate a .env file in the root directory (or use the default values in docker-compose.yml for local dev):
PORT=8080
DATABASE_URL=postgres://user:password@localhost:5433/checkin_db?sslmode=disable
JWT_SECRET=your_super_secret_keyStart the PostgreSQL database using Docker Compose:
make upApply database migrations to set up the schema:
make migrateStart the API server:
make runThe server will start on port 8080 (or the port specified in .env).
The API is documented using Swagger. Once the server is running, access the interactive documentation at:
http://localhost:8080/swagger/index.html
You can use the "Authorize" button to enter your Bearer token for testing protected endpoints.
make build: Build the binary.make run: Run the application.make up: Start Docker containers.make down: Stop Docker containers.make migrate: Run database migrations.make swag: Regenerate Swagger documentation.make test: Run tests.
.
├── cmd/
│ └── server/ # Application entry point
├── internal/
│ ├── adapter/ # Database adapters (PostgreSQL)
│ ├── api/ # HTTP handlers, middleware, and router
│ ├── config/ # Configuration loading
│ ├── core/ # Domain logic (services, domain models, ports)
│ └── pkg/ # Utility packages (logger, validator, response)
├── migrations/ # SQL migration files
├── docs/ # Swagger documentation files
├── docker-compose.yml # Docker Compose configuration
└── Makefile # Development commands