Base application built with the next stack:
- React: Using redux toolkit and redux toolkit query to fetch data from the backend, the application was generated with vite.
- Go: Using golang in the backend, echo for the API framework and some other dependecies for the creating utilities.
- PostgreSql: The DB is created in docker, see the makefile inside the backend folder and docker-compose.yml file in the same folder for more detail.
- Unix OS(MacOs, Linux or WSL).
- Docker and Docker Compose if applicable.
- NodeJs(Suggest to use NVM).
- Make command.
- Run backend:
- Move to backend folder in terminal (
cd ./backend). - Run command
make create-dbfor creating db container in docker. - Run command
make seedfor loading development data in db. - Run command
make runto run backend application.
- Move to backend folder in terminal (
- Run frontend:
- Move to frontend folder in terminal(
cd ./frontend). - Run command
npm installto install dependencies. - Run command
npm startto run application in development mode.
- Move to frontend folder in terminal(
- Open
http://locahost:8080in a web browser.
This template generates types for the frontend from the backend types, the configuration for this can be found at
./backend/ts-generator.go file.
These types get generated into ./frontend/src/model/generated folder.
For regenerating these types just move to
./backend in terminal and run the next command:
make generate-ts
Of course this may need more work to be done here, but this template gets a basic approach for this process ready, for generating a prod version just run the next command from the root folder:
make build
This will generate a folder ./dist containing the backend binary, the frontend static folder containg static files from our application and a dot env file.
The static files will be served by our backend in the root path, so frontend in this case it would be served in the same port.
To execute the binary just run the next command:
cd ./dist && ./app
