Event management system
Event management system - This can manage generic events defined by user and communicate this with subscribers
Please refer Wiki or GithubIO for better readablity
Setup
Building the project
gradlew.bat clean bootRun
For Linux or Mac: Open the Terminal emulator in the project directory
run command ./gradlew clean bootRun
Note: In case you just want to generate JAR file, replace bootRun
with bootJar
or build
Running the jar can be done using command java -jar -Ddebug=true build/libs/velocity_{version}_{yyMMddHHmm}/server-{version}.jar
example:
pranava@ubuntu:~/velocity$ pwd
/home/pranava/velocity
pranava@ubuntu:~/velocity$ ./gradlew clean build
> Task :compileKotlin
BUILD SUCCESSFUL in 3s
5 actionable tasks: 5 executed
pranava@ubuntu:~/velocity$ java -jar -Ddebug=true build/libs/velocity_0.0.1-SNAPSHOT_2003102238/server-0.0.1-SNAPSHOT.jar
Spring Boot (v2.2.4.RELEASE)
embedded.tomcat.TomcatWebServer : Tomcat started on port: 80 (http) with context path '/api'
com.velocity.VelocityApplicationKt : Started VelocityApplicationKt in 4.256 seconds
If you are seeing Tomcat Started and Started VelocityApplicationKt, means project successfully built and running on port 80
Note: -Ddebug=true
switch is temporary. Future commits would include Custom Run configuration file.
Insert roles into roles
collection in MongoDB.
db.roles.insertMany([
{ name: "ROLE_USER" },
{ name: "ROLE_MODERATOR" },
{ name: "ROLE_ADMIN" },
])
Note: Currently this is manual step. In future this might be done through an API
Running the project: Open a web browser and open http://localhost/api/server/info
which will show a welcome page
Configurations
The application.properties
file contains the linespring.data.mongodb.uri=${MONGO_URL_CON}
in which MONGO_URL_CON
is the MongoDB database URL of the MongoDB server which is the system environment variable
MONGO_URL_CON
as system environment variable in HERELike MONGO_URL_CON
environment variable setup, JWT_SECRET_KEY
also need to be set as environment variable. The key is any string which represent as encryption password
The application.properties
has a key called com.velocity.jwtExpirationMs
which represents JWT expiration time in milliseconds. Default is 1-Day(86400000 ms)
The port number of the server can be configured in application.properties
file. Default port number is port 80
Postman collection 2.1 can be found in velocity/docs/velocity.postman_collection.json
Project structure
The current project structure is just a draft. After getting comfortable with Spring, package refactor will be done.
```
pranava@ubuntu:~/velocity/src/main$ pwd
/user/pranava/velocity/src/main
pranava@ubuntu:~/velocity/src/main$ tree
.
├── java # Java files
├── kotlin # Kotlin files
│ └── com
│ └── velocity
│ ├── VelocityApplication.kt # Main class
│ ├── config # DB configs. (Temporary)
│ │ └── MongoConfig.kt
│ ├── controller # Entry point of API (Apart from filters)
│ │ ├── AuthController.kt
│ │ └── UserController.kt
│ ├── dao # Access point for all repository (DB and network calls)
│ ├── db # Datebase
│ │ ├── doc # Collection models
│ │ └── repo # Base Reposiotries to access collections
│ ├── model
│ │ ├── ERole.kt # Static predefined roles
│ │ └── payload # Request/Response models
│ │ ├── request # Request models
│ │ └── response # Response models
│ ├── security # Spring security related modules
│ │ ├── WebSecurityConfig.kt # Route - authentication/authorization configs
│ │ ├── jwt # JWT related classes
│ │ └── service # Secuirty support services (UserDetailsService implementations)
│ └── service # Application business logics
└── resources # All the Spring configuration files
└── application.properties # Application properties (Like MongoDB connection URL, JWT secret key)
```
Learning resources
Keywords
Project Velocity -
Copyright (c) 2020 Pranava Giligar