These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Run the command below to clone the projects repository, this will clone both the projects repository and the soul
submodule repository.
git clone --recurse-submodules https://github.com/DeepBlueCLtd/Soul4ReactAdmin.git
-
Copy the
chinook.db
database file from thedb
folder to thesoul/core
foldercp db/chinook.db soul/core
-
Create a
.env
file in thesoul/core
folder and duplicate the sample environment varialbescd soul/core cp .env.sample .env
-
Edit the environment variables
-
Edit the Database name and add your frontend applications URL to the CORS white list
nano .env DB=chinook.db CORS_ORIGIN_WHITELIST=http://localhost:5173
-
-
Install the
npm
packagesnpm install
-
Run the core API
npm run dev
-
Create a
.env
file and duplicate the sample environment varialbescd client cp .env.sample .env
-
Install the npm packages
npm install
-
Run the client application
npm run dev
-
Go to the
/soul/core
folder and create a folder named_extensions
and create a file namedapi.js
in the folder.cd soul/core md _extensions cd _extensions && touch api.js
-
Copy and paste the code below to the
api.js
fileconst path = require("path"); const express = require("express"); const reactAdminClient = { method: "GET", path: "/api/client", handler: (req, res, db) => { const clientPath = path.join(__dirname, "dist", "index.html"); res.app.use(express.static(path.join(__dirname, "dist"))); res.sendFile(path.join(clientPath)); }, }; module.exports = { reactAdminClient, };
-
Run the
pwd
command in the_extensions
folder and copy the absolute path of the folder, and add it to your .env filenano .env EXTENSIONS=/absolute/path/to/_extensions
-
Go to the client folder and build the project
cd ../../../client yarn build
-
After finisshing the build, copy the
dist
folder and paste it to thesoul/core/_extensions
foldercp -R dist ../soul/core/_extensions
-
Go to the
soul/core
folder and run the projectcd ../soul/core npm run dev
-
Test if the project is working in your browser
http://localhost:8000/api/client
Test the getList
provider
- Click the
Genres
tab - This will trigger the
getList
provider and will fetch list of data from theSoul
API.
Test the getOne
provider
- Click the
Genres
tab - Click the first row of the
Genres
table - This will trigger the
getOne
provider and will fetch a single record
Test the getMany
provider
-
Click the
Invoice Items
tab -
When you click the tab, the
<ReferenceField />
component will trigger thegetMany
provider and it will fetch list ofTracks
by using theTrackIds
http://localhost:8000/api/tables/tracks/rows/1,2,3,4,5,6
Test the getManyReference provider
- Click the
Albums
tab - Click the first row of the Albums table
- When you click the first row, the
<ReferenceManyField />
component will trigger thegetManyReference
provider and it will fetch list ofTracks
that belong to the currentAlbum
Test the update
provider
- Click the
Genre
tab - Click the
Edit
button from the first row - When you click the button you will be redirected to the edit form
- Edit your data and click the save button
- When you click the save button, react admin will trigger the
update
provider and aPUT
request will be sent to theSoul
API
Test the updateMany
provider
- Click the
Invoice Item
tab - Select multiple records by using the checkbox buttons
- When you select the items you will get a
Make Free
button in the top right cornor - Click the
Make Free
button - When you click the
Make Free
button, react admin will trigger theupdateMany
provider and a bulk update request will be sent to theSoul
API
Test the create
provider
- Click the
Genre
tab - Click the
Create
button which exists in the top right corner - When you click the button you will be redirected to the create form
- Add your data and click the save button
- When you click the save button, react admin will trigger the
create
provider and aPOST
request will be sent to theSoul
API
Test the deleteMany
provider
- Click the
Invoice Item
tab - Select one of the rows by clicking the checkbox
- When you click the checkbox button you will get a Delete button in the top right cornor
- Click the Delete button
- When you click the Delete button, react admin will trigger the
deleteMany
provider and aDELETE
request will be sent to theSoul
API.