The React frontend is built with Vite.
This is a REACT frontend designed to utilize the latest stable version of DKAN 2.x as a backend.
This application serves as a starter app, or example of how to use the data-catalog-components library to easily create open data catalogs.
- Node ^16
- Follow the DKAN DDEV add-on steps for starting a new project.
If you have a backend already running and just need the frontend:
- Clone this repository in your docroot
git clone https://github.com/getdkan/data-catalog-app frontend
. The DKAN DDEV add-on is structured to run commands in a folder namedfrontend
so frontend repos could be swapped if needed. - Install the dependencies with npm:
cd frontend
npm install
oryarn install
- Run the server:
npm start
oryarn start
- Your site is now running at
http://localhost:3000
- Your site is now running at
- Build the public files
npm run build
- To complete the setup like the auto setup, setup the DKAN JS Frontend module that comes with the DKAN core installation. Steps can be found here: DKAN JS Frontend Module.
- Run
npm install
- Run
npm run start
to view the app in development mode atlocalhost:3000
.
This is meant to be a blueprint for your frontend, from which you can make minor color and logo changes or major component or page layout customizations.
├── cypress # Integration tests
├── build # The output of the build process
├── public # Base files that the app builds with
├── src # This directory will contain all of the source code
| ├── assets # Place to store images and content/config files
| ├── components # Configure your page structure with the layout component
│ ├── pages # Components in this directory become pages automatically with paths based on their file name
│ ├── services # Provides the connections to the backend api
| └── templates # Ideas for how to assemble components to display the data
│ └── theme # Add custom fonts, colors, and css here
├── package.json # App dependencies
- Edit the
src/assets/config.json
file to change the site title, slogan, logo, and container class. - Edit the
src/theme/styles/_variables.scss
file to change the colors and fonts of your site. - Add custom .scss files to
src/theme/styles/
to override the default css classes with your new color variables and other changes. - Import your .scss files to
src/theme/styles/index.scss
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches vitest and runs any found test files. The demo app does not currently contain any Vitest / Jest tests.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Runs the React site in production mode, independently from drupal.
To run Cypress tests on a local React-only install of this repo, ensure the app is running at localhost:3000
. In a separate terminal, use npx cypress run --config baseUrl="http://localhost:3000"
.
If the frontend is installed within a DKAN site, navigate to the frontend
folder containing your installation of this repo. Ensure your full site is running, and take note of its URL (PROJECT_NAME.ddev.site), where PROJECT_NAME
is variable. Run tests using npx cypress run --config baseUrl="YOUR_DDEV_URL"
, using your project URL for the baseUrl argument