/react-mantine-speckle-template

Speckle app built with React, TypeScript, Vite and MantineUI

Primary LanguageTypeScriptApache License 2.0Apache-2.0

React Speckle Template

A React app in TypeScript built with Vite and MantineUI

Screenshot

Getting Started

Prerequisites

Installation

To get started, clone this repository and install the dependencies:

git clone https://github.com/ocni-dtu/react-mantine-speckle-template.git
cd react-mantine-speckle-template
yarn install

Configuration

The application requires a Speckle Server to be running and a Speckle Application to be configured on the server. The application will use the http://localhost:8000 URL by default, so make sure to configure the application with this URL.

This template uses the main Speckle Server by default. To use a different server, you can change the VITE_APP_SERVER_URL environment variable in the .env file.

To use your own Application, you can change the VITE_APP_APP_ID and VITE_APP_APP_SECRET environment variables in the .env file. You will have to configure the Speckle Application redirect URL to http(s)://<your-app-url>/auth.

Application Structure

The application is structured as follows:

  • src/components - contains the React UI components.
  • src/contexts - contains React Context objects used to share authentication across the application
  • src/pages - contains pages for the app
  • src/queries - contains GraphQL queries/mutations, together with autogenerated hooks to interact with Speckle's API
  • src/main.tsx - the application entrypoint

Available Scripts

In the project directory, you can run:

npm dev

Runs the app in the development mode.
Open http://localhost:8000 to view it in the browser.

The page will reload if you make edits.

npm codegen

Generate hooks from src/queries/queries.graphql to use in the app

npm build

Builds the app for production to the dist folder.\

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

Credits

This template is heavily inspired by Antoine Dao's speckle-demo-app-react