MolMeDB is open-source...
This repository is fully prepared for easy setup using Docker. Before starting, copy the appropriate docker-compose file as follows.
For local development:
cp docker-compose-development.yaml docker-compose.yamlFor production:
cp docker-compose-production.yaml docker-compose.yamlNever modify the default docker-compose-*.yaml files. Your local docker-compose.yaml is added to .gitignore and will not be indexed by git.
First, create the .env file to set all the necessary values.
cp .env.example .envThe file is mostly prepared for local development, but some values still need to be checked. First, install the necessary libraries for developing the Laravel application on your machine by following the official documentation - https://laravel.com/docs/12.x/installation.
Then, run the following command:
composer install
php artisan key:generateThe first command installs required dependencies and the second will generate and fill the APP_KEY in the .env file. If you want to send emails from your environment, make sure to configure the MAIL_* variables. Otherwise, email sending will only be replaced by log messages in your console. Further configuration of other variables is outlined in the following sections.
First, prepare the docker-compose.yaml file as mentioned earlier:
cp docker-compose-development.yaml docker-compose.yamlSince development containers are usually slower than running directly on your local machine, I recommend commenting out the web, app, app-scheduler-worker and frontend containers in your docker-compose.yaml. This way, only the db and other side containers will be build. These containers are used for setting up the PostgreSQL database, installing required packages, and running the Adminer application on port 8080, which is a replacement for PHPMyAdmin for PostgreSQL databases. To build and start the containers, run the following command:
sudo docker compose upIf you don’t want to monitor the logs, you can add the -d flag to run in the background:
sudo docker compose up -dHowever, I recommend running the first command at least the first time in case any errors occur. If you’ve commented out the app and web sections, you will need to run your local server via Composer. Otherwise, your application will already be available at http://localhost:9080.
First, check your .env file, specifically the DB_HOST and DB_PORT variables, which must be set to
DB_HOST=127.0.0.1
DB_PORT=5434If you are developing locally and have commented out the app section in docker-compose.yaml, don’t forget to change the APP_URL value to
APP_URL=http://localhost:8000Clear the configuration cache
php artisan config:clearTo verify the database connection, try running the migration command to populate the database structure
php artisan migrateIf everything went well, Adminer will be available at http://localhost:8080. Log in using the credentials from the .env file. Make sure to select PostgreSQL as the connection type and set the host to db. Use the values from DB_USERNAME, DB_PASSWORD, and DB_DATABASE for the username, password, and database name. After logging in, you should see the tables created by the migration.
For local development, we usually don’t need to work with real data. Therefore, seeders have been added to the application to populate the database with fake data for testing purposes. Note: These features are not available on the production server. To populate the database, run the following command:
php artisan db:seedDuring development, it’s common we sometimes need to empty and populate the database with a new data. This can be easily done with the following command:
php artisan migrate:refresh && php artisan db:seedNow, you can start your application with the command
composer run devIf everything went well, the application will be available at http://localhost:8000. The database seeding will create an admin user with the following credentials
- email: admin@molmedb.cz
- password: admin
And that’s it!
All frontend files are placed in ./frontend folder. To run the frontend for development purpose, go to the frontend folder
cd frontendCreate .env file with the following command
cp .env_template .envInstall NextJs following the official documentation - https://nextjs.org/docs/app/getting-started/installation and install required packages
npm install Finally, run the frontend with
npm run dev and the frontend will be available on http://localhost:3000.
Remember! Always change the git branche before making any changes in the repository. Pushing changes to the
mainbranch is restricted.