-
Notifications
You must be signed in to change notification settings - Fork 24
Dev's Guide: Backend basic concepts
Ashar Fuadi edited this page Aug 10, 2018
·
17 revisions
This section explains the basic knowledge required for understanding Judgels codebase on the backend side.
- Java 8
- Dropwizard for main REST server app
- MySQL for database
- JPA implemented with Hibernate for ORM
- Caffeine for cache
- Dagger for dependency injection
- Immutables for objects immutability
- Guava for collections
Judgels adapts the database design explained here: Phabricator Database Schema. Some highlights:
- Each object in Judgels has a JID (Judgels ID) in the form of JID-XXX-YYYYYYYYYYYYYYYYYYYY, where X is object type code and Y is a shortened UUID.
- No foreign keys, since we want that objects can be migrated between different Judgels app instances.
- Properties that have complex structure are stored either on disk database as JSON strings. For example: grading result details.
Additionally, each object may have the following columns:
- createdBy, createdAt, createdIp: user, time, and IP when this object is created.
- updatedBy, updatedAt, updatedIp: user, time, and IP when this object is updated.
-
Service: declares the REST API endpoints. Example:
ContestService
. -
Resource: implements the REST API endpoints. Example:
ContestResource
. -
Role checker: authorizes REST API calls. Example:
ContestRoleChecker
. -
Store: manages CRUD operations of business objects. Example:
ContestStore
. -
Dao: declares the CRUD operations in database. Example:
ContestDao
. -
HibernateDao: implements the CRUD operations in database. Example:
ContestHibernateDao
. -
Model: represents a row in a database. Example:
ContestModel
.