Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? Use the template at the bottom!
Add your files
cd existing_repo
git remote add origin https://github.com/imamponco/v-gin-boilerplate
git branch -M main
git push -uf origin main
Collaborate with your team
Test and Deploy
Use the built-in continuous integration in GitLab.
Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to makeareadme.com for this template.
Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
Name
Choose a self-explaining name for your project.
Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
Installation
Prerequisites
- Goland IDE or Visual Studio Code
- Go 1.18
- UNIX Shell
Use wsl2
in Windows 10
- Git
- Make
- Docker and Docker Compose CE
Quick Start Using Docker (Recommended)
# Set-up development environment
make configure
# Set-up environment (.env) database for docker
DB_HOST=db
# Set-up database (create container via docker compose)
make container-setup
# Set-up your database based on your env
create database based on your .env
# Build and serve for local development
make serve-docker
Configuration
This application is configurable from .env
file
Below are available configuration for the project:
Scope |
Key |
Description |
Required |
Value |
Common |
DEBUG |
Debug Mode |
|
Boolean. Default: false |
|
DEBUG_PORT |
Expose debug port for delv |
|
2345 |
|
LOG_LEVEL |
Log level debug |
|
String. Default: debug |
|
APP_NAME |
App name |
✓ |
String. svc |
|
STAGE |
Set stage configuration |
|
String: development / production |
|
|
|
|
|
|
|
|
|
|
Server |
PORT |
Server listen port |
✓ |
1024-65535 |
|
SERVER_LISTEN_SECURE |
Listen in secure mode for base url resolver |
|
Boolean, Default: false |
|
SERVER_TRUST_PROXY |
Show debug responses |
✓ (Required for Deployment via Reverse Proxy) |
String Array of IP Address, separated by comma. Default: <not set> . Set to * to allow all |
|
SERVER_BASE_URL |
Set base url for server |
|
http://localhost:8000 |
|
SERVER_CERT_PATH |
Set cert name |
✓ (If listen is secure) |
cert.cer |
|
SERVER_CERT_PATH_KEY |
Set cert key name |
✓ (If listen is secure) |
cert.key |
|
CORS |
Setup cors for http |
|
String Array of Domain, separated by comma. Default: <not set> . Set to * to allow all |
|
|
|
|
|
Datasource |
DB_DRIVER |
Database driver |
✓ |
String. postgres |
|
DB_HOST |
Postgres server host |
✓ |
String |
|
DB_PORT |
Postgres server port |
✓ |
1024-65535 |
|
DB_USER |
Postgres server username |
✓ |
String |
|
DB_PASS |
Postgres server password |
✓ |
String |
|
DB_NAME |
Postgres database |
✓ |
String |
|
DB_BOOT_MIGRATION |
Enabled migration up version when booting |
|
|
|
|
|
|
|
** Client ** |
JWT_KEY |
String for secret jwt |
✓ |
String mA7DvlMDADA1yuNuXDAR213CzeZaBLSA |
|
JWT_EXPIRY |
JWT Expiry |
✓ |
Default: 21600 |
Migrations
This application is implementing go migrate for migrating database.
Commands available to use are in below:
# Prints the details and status information about all the migrations.
make db-status
# Upgrade database
make db-up
# Undo to previous migration version
make db-down
# Clean database
make db-clean
Updating Dependencies
- Run
go mod vendor
to download dependencies
- Restart service container
Debugging
Attach debugger in your IDE to port 2345 (or as defined in DEBUG_PORT
)
Contributors
Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
License
For open source projects, say how it is licensed.
Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.