Kotlin Admin Template is a starter project for a typical admin project. It has a user database with roles, authorization per endpoint, and a frontend for displaying data. The project includes the following libraries:
- Vuetify (Material Design Vue components)
- Vue (JavaScript view layer library)
- Javalin (Web server library)
- JDBI (Database library (not an ORM))
- SQLite (Embedded database)
From the root directory (kotlin-admin-template
), do:
./mvnw clean install
java -jar target/kotlin-admin-template-jar-with-dependencies.jar
The server should now be running on http://localhost:8080
The project is packaged by feature rather than layer, for example accounts
and example
are packages in the project. Each feature has a Controller
responsible for handling HTTP input and output, and a Service
responsible for communicating with a data store (typically a database, but could also be an API).
The frontend is based on having one Vue app per URL, and routing is done server side. This allows you to re-use your auth logic for both backend and frontend routes. The frontend architecture is described in detail in this tutorial.
kotlin-admin-template
├──src
│ ├──main
│ │ ├──kotlin
│ │ │ └──kat
│ │ │ ├──account //crud for user accounts
│ │ │ ├──auth //authentication and authorization
│ │ │ ├──example //an example crud feature
│ │ │ ├──Config.kt //application config
│ │ │ └──Main.kt //server config, routes and main function
│ │ └──resources
│ │ ├──public //static files (logos, illustrations)
│ │ └──vue //vue files
│ │ ├──components //reusable vue components
│ │ ├──pages //one-off vue components (pages with URLs)
│ │ └──layout.html //vue setup file
│ └──test
│ └──kotlin
│ └──kat
│ ├──api //http-client tests towards api
│ └──view //browser tests (selenium)
└──pom.xml
The project is intended to get you up and running as fast as possible. Before putting this into production, you'll probably want to do a few things:
- Setup your own session database (tutorial)
- Connect to a login provider, such as auth0
- Replace SQLite with PostgreSQL (or similar)
- Setup a database migration tool (like liquibase)