Skip to content

This project is my custom template for creating react app using webgl. For a starting point, the project already has 2 pages with few meshes, 1 GLSL transition and a scroll linked to the canvas. It's powered by React Three Fiber and some GLSL for the transition.

License

Notifications You must be signed in to change notification settings

JustalK/TEMPLATE-REACT-APP-GLSL

Repository files navigation

Alt text

REACT APP TEMPLATE

Goal

This project is a template for building React App linked to WebGl with all my favorite tools already configured.

Obviously, the app is using the latest version of react. For avoiding the relative path, I modified the webpack and allowing the import with an alias. I also added the support for sass files.

In addition, I added prettier and configured it for working well with esLint. Finally, I added the basic usefull package such as the router and the helmet.

For the WebGl part, I am using React Three Fiber and GLSL for the shader. For a starting point, the project already has 2 pages with few meshes, 1 GLSL transition and a scroll linked to the canvas.

Plan of the presentation

I explain with all the details how I build the project and my way of working.

Documentation

Code documentation

The jsdoc can be generated locally with the following command :

npm run build:docs

Organization

Organization of the global folder

Folder's Name Description of the folder
out The documentation generated by jsdoc
public Regroup the images and public files
src Regroup the source code

Organization of the src folder

Folder's Name Description of the folder
components Regroup the components used inside the pages
constants Regroup the exported constants
pages Regroup the components representing the pages
services Regroup the services of the app
styles Regroup the scss files

Development

Creating a page

For creating a new page, you need to set create a components inside the folder pages and to connect it in app by creating a Panel with the size of the page and creating the route.

Packages

  • react-app-rewired: Allow us to rewrite the config of React without ejecting the app
  • customize-cra: Allow us to rewrite the config of webpack and create module alias
  • eslint: For linting the code with EsLint
  • @babel/eslint-parser: Changing the parser for having access to eslint in babel
  • eslint-config-airbnb: For having the set of rules airbnb for eslint
  • eslint-plugin-import: For managing the alias import with eslint
  • eslint-plugin-react: For managing the react rules
  • prettier: For formating the style of the code
  • eslint-plugin-prettier: For using the prettier package with esLint
  • sass: For using the SASS css preprocessor (scss)
  • jsdoc: For managing the dev documentation of the project
  • react-router-dom: For managing the router and the path to the differents pages
  • react-helmet: For managing the meta of the differents page
  • three: Allow us to use the webgl easily
  • @react-three/fiber: For connecting three with react
  • @react-three/drei: An extension of r3f for using the shader
  • wouter: For managing the routing of the app easily

Running

For running the API, a single command is needed.

npm run start

Commands

  • npm run start: Run the linter and then the project
  • npm run build: Build the project
  • npm run test: Run the test of the project
  • npm run eject: Eject the application (sometimes necessary)
  • npm run linter:fix: Run the linter and fix the errors
  • npm run build:docs: Build the documentation from the comments in the code
  • npm run check-update: Check if the package are up to date (for now, everything is except the testing and webvital)

About

This project is my custom template for creating react app using webgl. For a starting point, the project already has 2 pages with few meshes, 1 GLSL transition and a scroll linked to the canvas. It's powered by React Three Fiber and some GLSL for the transition.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages