This project is a full-stack application that simulates a Node.js project with a Go modules backend and Jekyll documentation wiki. It utilizes Vite for the frontend build tool and ReactJS for the user interface, along with React Testing Library, Jest, and Playwright for testing.
gota-react
├── backend # Go backend application
│ ├── go.mod # Module dependencies, this is the build configuration
│ ├── go.sum # Module checksums, this contains the go mod download github.com/user/modname hash sum
│ ├── main.go # Entry point for the Go application
│ ├── cmd # External module execution commands
│ │ ├── api-server # Sample file-server module call
│ │ │ └── main.go # file-server module
│ │ └── metrics-analyzer # Sample analyzer module call
│ │ └── main.go # analyzer module
│ ├── internal # Internal module objects which are protected from export
│ │ ├── auth # Sample file-server module call
│ │ │ └── auth.go # internally used code freely refactorable inside internal directory module
│ │ ├── metrics # Sample metrics module call
│ │ │ └── analyzer.go # internally used code freely refactorable inside internal directory module
│ │ ├── model # Sample model module call
│ │ │ └── model.go # internally used code freely refactorable inside internal directory module
│ │ ├── private_test.go # Testing for component inside private
│ │ └── private.go # Internal folder is specifically ignored by go processor
├── frontend # React frontend application
│ ├── __mocks__ # Testing data object simulations for mocking data
│ ├*** coverage # Generated code coverage metrics data from build
│ ├*** dist # Generated production artifacts from build
│ ├*** node_modules # Generated from build as download to support dependencies
│ ├── public # Public assets
│ │ └── index.html # Main HTML file
│ ├── src # Source files for the React app
│ │ ├── assets # Asset files
│ │ │ └── react.svg # Scalable vector graphic test image
│ │ ├── App.css # CSS component
│ │ ├── App.tsx # Main React component
│ │ ├── index.css # CSS component
│ │ ├── main.tsx # Entry point for the React app
│ │ └── vite-env.d.ts # Vite Types reference
│ ├── tests # Test files
│ │ ├── jest # Jest framework unit testing files
│ │ │ └── unit.spec.tsx # Tests for the App component
│ │ └── playwright # Playwright framework end-to-end integration testing files
│ │ │ └── e2e.spec.tsx # Tests for the App component
│ ├── .gitignore # Version controls ignore directives
│ ├── eslint.config.js # eslint configuration
│ ├── index.html # default entry point for application
│ ├── package.json # npm configuration
│ ├── README.md # frontend specific README document
│ ├── vite.config.ts # Vite configuration
│ ├── tsconfig.node.json # TypeScript node context configuration
│ ├── tsconfig.app.json # TypeScript app context configuration
│ └── tsconfig.json # TypeScript configuration
├── scripts # Scripts for project management
│ ├── check-config.sh # Script to check project configuration
│ └── check-tools.sh # Script to check tool availability
├── wiki # Jekyll Ruby Gem documentation wiki site
│ └── _config.yml # Jekyll Site configuration
└── README.md # Project documentation
To get started with this project, follow the instructions below:
Ensure you have the following installed:
- Node.js (version 20 or higher)
- Go (version 1.19 or higher)
- npm (comes with Node.js)
-
Clone the repository:
git clone <repository-url> cd gota-react
-
Navigate to the frontend directory and install dependencies:
cd frontend npm install
-
Navigate to the backend directory and initialize the Go module:
cd backend go mod tidy
-
Start the Go backend:
cd backend go run main.go
-
Start the React frontend:
cd frontend npm run dev
To run the tests for the React application, navigate to the frontend directory and execute:
cd frontend
npm test
check-config.sh
: Checks the configuration of the project.check-tools.sh
: Checks the availability of required tools and dependencies.
This project is licensed under the MIT License. See the LICENSE file for details.
This system combines multiple coding frameworks into a combined project. These framework supporting installations and requirements are listed below:
- Create hosting directory
mkdir -p ~/Documents/github/gota-react
- Install pre-requisite software
- Go
sudo apt install golang
- NodeJS
sudo apt install nodejs
npm install -g typescript
- Vite
sudo apt install vite
- Ruby
sudo apt-get install ruby-full build-essential zlib1g-dev
- Set new Ruby gem installs to local user director
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
gem install jekyll bundler
gem update --system
- Go
- Setup New Project
cd gota-react
- Create Front End application
npm create vite@latest frontend --template react
- Assumption Not using vitest, there are vitest plugin compatibility issues. https://vitest.dev/
- Create Go Backend application
mkdir backend && cd backend && go init && cd ..
- Create Wiki
jekyll new wiki
cd wiki
bundle exec jekyll serve
go test -v
go test
Files named XXX_test.go
will execute as tests.
https://go.dev/doc/modules/layout
As a reminder, we assume that the module line in go.mod says:
module github.com/someuser/modname
Ensure libraries available:
sudo apt update
sudo apt install libgtk-4-1
sudo apt install libgraphene-1.0-0
npx playwright install chromium
npx playwright install
-
React Developer Tools install locally to your browser.
While searching for how to correct the tsconfig paths setups I had issues getting the vite and jest interpretations to function correctly.
I found an alternate to use '@/' to instead use '#src/' for alias names. The reason for the '#' symbol instead of the '@' is that the '@' is not allowed for syntax configuration inside package.json.
- In package.json
"imports": {
"#src/*": "./src/*"
}
- In tsconfig.json
"baseUrl": ".",
"paths": {
"#src/*": [
"./src/*"
]
- in vite.config.ts
alias: { '#src': path.resolve(__dirname, 'src') }
This is far simpler than coordinating the import alias syntax across multiple other configuration files.
Settings in the TS.Config.json at the top level are used across the project. I have tried to remove items in tsconfig.app.json which are present in tsconfig.json. The main reason items were added to the tsconfig.json was to allow the interoperability between src and test to allow location of modules. Additionally paths aliases are shared between src and test to simplify and give consistency to coding references (too many ../../ can lose one).