This uses the following stacks:
- Project is bootstrapped using Vite with the following options: React and TypeScript.
- TailwindCSS is the CSS framework.
- Prettier plugin for TailwindCSS is enabled.
- Air runs the server in a development reload loop (install first with
go install github.com/cosmtrek/air@latest
) - Gin is the HTTP web framework.
- Viper for reading configuration from environment variables.
- Zap for server-side logging.
Additional features:
VSCode will run the following tasks in the background:
npm run dev
npm run dev-tw
The following subaths in client/src/<path>
are mapped to @<path>
in TypeScript
assets
components
context
utils
client/package*.json
: change{"name": "vite-project"}
to your project's name.server/go.mod
: change module path to your project's repo URL.server/Makefile
: changePROJ
to your project's name andORGPATH
to your project's base repo URL..vscode/tasks.json
: change the environment variables (e.g. REACT_GO_TEMPLATE_LISTEN_ADDRESS) based on your app's name.client/vite.config.ts
: replace theenvPrefix
based on your app's name.client/src/utils/server.ts
: change environment variable prefixes (ie REACT_GO_TEMPLATE_*).
All configuration is read from environment variables.
Key | Scope | Description |
---|---|---|
REACT_GO_TEMPLATE_SERVER_URL |
Client | The URL of the backend server. |
REACT_GO_TEMPLATE_LISTEN_ADDRESS |
Server | Binds the backend server to this address. Should be the same as REACT_GO_TEMPLATE_SERVER_URL . |
REACT_GO_TEMPLATE_ENABLE_CORS |
Server | Enables CORS. Useful if the client and server are running on different processes. |