Fullstack App
This repository contains a full-stack application, built with Go for the API layer and React for Client layer.
Table of Contents
Project Overview
This repository contains a full-stack application, built with Go for the API layer and React for Client layer. This makes deployment and maintenance straightforward. This repository also follows the best practices for Go and React applications. Apart from that this follows the Golang standards for project layout. Treat this as a starting point and further extend it to suit your needs.
Features & Highlights
-
Go API:
- Fiber - Web framework.
- Air - Live reload for Go apps.
- Swagger - API documentation.
- Make - Build automation.
-
React Client:
-
Fullstack
- Concurrent Development - Run both the API and the React app concurrently.
- Production Build - Build a single executable for the API and the React app.
Installation
Ensure you have Go and Node.js installed on your machine. If you don't have them, you can follow the installation guides for Go Installation and Node.js Installation.
-
Clone the repository:
git clone <repository-url>
cd <project-directory>
-
Install Go & Node dependencies:
make deps
Running the Application
Development Mode
In development mode, the backend API and the frontend React app runs concurrently. The React app will be served on a development server, and the Go backend will handle API requests and serve the built React app.
-
Start the development environment:
make dev
This will:
- Build the Go API and generate Swagger documentation.
- Keep watching the react app for changes and keep building it in realtime.
- Start the Go backend with hot reloading using
air
.
Production Build
In production, a single executable is built, containing both the backend and the bundled React client.
-
Build for all platforms:
make build
-
Run the generated binary:
make run
This will start the API and serve the React app.
Commands
Install Dependencies
Install Go and Node dependencies:
make deps
Build the Application
Build the Go API and the React client:
make build
Run the Application
Run the Go API and serve the React client:
make run
Test the Application
Run tests for the Go API and the React client:
make test
Swagger Documentation
Generate Swagger documentation:
make swagger
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is open-sourced software licensed under the MIT license.