Autograd is a web app that provides code autograding for schools and university programming course. Currently it supports c++ language only.
TBD
The project is divided into two main components:
- cmd
- db
- frontend
- pkg
- proto
- testdata
The cmd
folder contains the entry point for the cli application
The db
folder contains the database schema and migration file & sqlc queries
The frontend
folder contains the frontend application written in reactjs
The backend is written in Go under pkg
folder and have this several components:
- config: hold the configuration & env for the application
- core: hold the core logic of the application
- each sub-package represent the domain of the application
- the domain creation, which part belong to which domain is up to the team and should be based on business process
- inside sub-package there is
*_cmd
&*_query
package that is the public API written in connectrpc framework - for data persistence, we interfacing using gorm & sqlc. Gorm is initially used, but will migrated to sqlc for better performance
- each sub-package represent the domain of the application
- dbconn: hold the database connection and migration logic
- dbmodel: hold the database model, use to query using
gorm
- httpsvc: wiring the service and http handler
- fs: hold the file system to store & retrieve the file
- jobqueue: handle jobqueue, it has outbox pattern implemented under
outbox
package- outbox: hold the outbox pattern implementation. It is used to do async operation
- logs: hold the logger configuration
- mailer: handle mailing feature, under it is mailing provider implementation
- pb: the generated protobuf file
- service: the wiring for the cmd & query
- xsqlc: the generated sqlc file
The proto
folder contains the protobuf file definition
The testdata
folder contains the test data for assignemnt & submission
- Prerequisites
- Golang v1.22+
- NodeJS v18+
- pnpm
- postgres v16
- mailhog
- modd
- sqlc
- sql-migrate
- Clone the project
- cd to the project directory
- copy .env file from .env.example
cp .env.example .env
- run
go mod tidy
to install the backend dependencies - cd to the
frontend
directory runpnpm install
to install the frontend dependencies
- run
make db-migrate-up
- run the postgres & mailhog service
- run
make run-server
to run the backend service
- cd to the
frontend
directory - run
pnpm dev
to run the frontend service
- run this command
go run cmd/autograd/main.go admin create --email john@doe.com --name "john doe" --password "supersecret"
create configuration
- run
sudo cp ./pkg/bin/isolate/default.conf /usr/local/etc/isolate