This repository contains source code for backend service of Inji Mobile and Inji Web. The modules exposes API endpoints.
The project requires JDK 21, postgres and google client credentials
-
Install pgadmin and update application-default.properties file with values
spring.datasource.username= spring.datasource.password=
-
Configuring Cache Providers:
By default, Mimoto uses Caffeine, a fast in-memory cache. This works well if you're running just one instance of Mimoto.
But if you're running multiple Mimoto instances (like in Docker Swarm, Kubernetes, or a load-balanced setup), each instance has its own separate cache with Caffeine — they don’t talk to each other.
In that case, switching to a shared cache like Redis is important. Redis lets all Mimoto instances share the same cached data, which helps keep things consistent and improves performance in distributed setups.
For detailed setup instructions (including running Redis with Docker CLI and updating configuration), see the Cache Providers Setup Guide section.
-
Configuring Postgres Database:
- Ensure Postgres Service is Available and Connected
-
Using Local Postgres Installation: If you have Postgres installed locally, run the database initialization scripts:
cd db_scripts/inji_mimoto ./deploy.sh deploy.properties- If needed, update the database connection properties in application-local.properties with your local Postgres credentials.
-
Using Docker Compose: If you don't have postgres setup in your local you can run Postgres along with Mimoto by using the
postgresservice in docker-compose.yml. -
Or, run Postgres using Docker while starting Mimoto through your IDE:
- Use the following Docker command to start the Postgres service and expose it on the default port 5432. Make sure this port is accessible from your local machine.
docker pull postgres:latest # Pull the Postgres image if not already available docker run -d --name postgres \ -e POSTGRES_USER=postgres \ -e POSTGRES_PASSWORD=postgres \ -e POSTGRES_DB=inji_mimoto \ -p 5432:5432 \ postgres:latest - Start Mimoto normally, following the instructions mentioned in Build & run (for developers) section.
- Use the following Docker command to start the Postgres service and expose it on the default port 5432. Make sure this port is accessible from your local machine.
-
- Update the following properties in
-
application-local.properties (when running through IDE), or
-
mimoto-default.properties (when running through Docker):
Look for properties starting with:
-
spring.datasource.* -
spring.datasource.* -
mosip.mimoto.database.*
- Check data in postgres by using the following commands
docker exec -it postgres psql -U postgres -d inji_mimoto # connect to container \dt mimoto.* # to see all tables in mimoto schema SELECT * FROM mimoto.<table_name>; # to see data in a table
- Ensure Postgres Service is Available and Connected
-
Refer to the How to create Google Client Credentials section to create Google client credentials and update below properties in
application-local.properties.spring.security.oauth2.client.registration.google.client-id= spring.security.oauth2.client.registration.google.client-secret= -
Add identity providers as issuers in the
mimoto-issuers-config.jsonfile of resources folder. For each provider, create a corresponding object with its issuer-specific configuration. Refer to the Issuers Configuration section for details on how to structure this file and understand each field's purpose and what values need to be updated. -
Add or update the verifiers clientId, redirect and response Uris in
mimoto-trusted-verifiers.jsonfile of resources folder for Verifiable credential Online Sharing. -
Keystore(oidckeystore.p12) Configuration: In the root directory, create a certs folder and generate an OIDC client. Add the onboard client’s key to the oidckeystore.p12 file and place this file inside the certs folder. Refer to the official documentation for guidance on how to create the oidckeystore.p12 file and add the OIDC client key to it.
- The oidckeystore.p12 file stores keys and certificates, each identified by an alias (e.g., mpartner-default-mimoto-insurance-oidc). Mimoto uses this alias to find the correct entry and access the corresponding private key during the authentication flow.
- Update the client_alias field in the mimoto-issuers-config.json file with this alias so that Mimoto can load the correct key from the keystore.
- Also, update the client_id field in the same file with the client_id used during the onboarding process.
- Set the
oidc_p12_passwordenvironment variable in the Mimoto service configuration inside docker-compose.yml to match the password used for the oidckeystore.p12 file. - Update the following properties in applicatio-local.properties file
mosip.oidc.p12.password=<your-keystore-password> mosip.kernel.keymanager.hsm.config-path=<path to the keystore file> mosip.kernel.keymanager.hsm.keystore-pass=<your-keystore-password>
- Mimoto also uses this same keystore file (oidckeystore.p12) to store keys generated at service startup, which are essential for performing encryption and decryption operations through the KeyManager service.
-
To configure any Mobile Wallet specific configurations refer to the Inji Mobile Wallet Configuration section.
-
Run the SQLs using /deploy.sh script. from db_scripts folder
./deploy.sh deploy.properties -
Build the jar
mvn clean install -Dgpg.skip=true -Dmaven.javadoc.skip=true -DskipTests=true -
Run following command
mvn spring-boot:run -Dspring.profiles.active=local
To use Redis (or any other cache provider), the service must be running and accessible to Mimoto. Both services (cache provider and Mimoto) must be on the same Docker network.
This can be done by adding them to a shared network in your docker-compose.yml file, or by using the following commands if they are running separately.
Example: Using Redis as Cache Provider
-
Ensure Redis Service is Available and Connected:
-
Using Docker Compose: You can run Redis alongside Mimoto by adding the below lines in docker-compose.yml. Docker Compose ensures both services run on the same network automatically.
- Add the Redis service under the services section:
redis: image: redis:alpine container_name: 'redis' ports: - "6379:6379" volumes: - redis-data:/data
- Make Redis a dependency for the Mimoto service:
mimoto-service: depends_on: - redis
- Add Redis data volume in the volumes section:
volumes: redis-data:
- Add the Redis service under the services section:
-
Or, run Redis using Docker while starting Mimoto through your IDE:
- Use the following Docker command to start the Redis service and expose it on the default port 6379. Make sure this port is accessible from your local machine.
docker pull redis:alpine # Pull the Redis image if not already available docker run -d --name redis -p 6379:6379 redis:alpine # Start a Redis container named 'redis' and expose it on port 6379
- Start Mimoto normally, following the instructions mentioned in Build & run (for developers) section.
- Use the following Docker command to start the Redis service and expose it on the default port 6379. Make sure this port is accessible from your local machine.
-
-
Update the following properties in
- application-local.properties (when running through IDE), or
- mimoto-default.properties (when running through Docker):
spring.session.store-type=redis # Store HTTP sessions in Redis spring.cache.type=redis # Store application data in Redis
-
Add and update the required Redis configurations in
- application-local.properties or
- mimoto-default.properties, similar to those in the application-default.properties file.
Look for properties starting with: spring.data.redis.*spring.session.redis.*
-
Check the cached data of the redis by running the following command:
docker exec -it redis redis-cli
- To simplify running mimoto in local for developers we have added Docker Compose Setup. This docker-compose includes mimoto service and nginx service to server static data.
- Follow the below steps to use custom build image in docker-compose
- Build the mimoto.jar
mvn clean install -Dgpg.skip=true -Dmaven.javadoc.skip=true -DskipTests=true - Build docker image by running the below command in the directory where Dockerfile is present, use any image tag
docker build -t <image-with-tag> . - Use newly built docker image in docker-compose file
Credits listed here