React / Vite + SWC / Express.js / Sequelize / PostgreSQL codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.
This codebase was created to demonstrate a fully fledged fullstack application built with React / Vite + SWC / Express.js / Sequelize / PostgreSQL including CRUD operations, authentication, routing, pagination, and more.
Demo app | With Create React App | Other RealWorld Example Apps
For more information on how to this works with other frontends/backends, head over to the RealWorld repo.
These instructions will help you install and run the project on your local machine for development and testing.
Before you run the project, make sure that you have the following tools and software installed on your computer:
- Text editor/IDE (e.g., VS Code, Sublime Text, Atom)
- Git
- Node.js
v18.11.0+
- NPM (usually included with Node.js)
- SQL database
To install the project on your computer, follow these steps:
-
Clone the repository to your local machine.
git clone https://github.com/TonyMckes/conduit-realworld-example-app.git
-
Navigate to the project directory.
cd conduit-realworld-example-app
-
Install project dependencies by running the command:
npm install
-
Create a
.env
file in the root directory of the project -
Add the required environment variables as specified in the
.env.example
file -
(Optional) update the Sequelize configuration parameters in the
config.js
file -
If you are not using PostgreSQL, you may also have to install the driver for your database:
Use one of the following commands to install:
Note:
-w backend
option is used to install it in the backendpackage.json
.npm install -w backend pg pg-hstore # Postgres (already installed) npm install -w backend mysql2 npm install -w backend mariadb npm install -w backend sqlite3 npm install -w backend tedious # Microsoft SQL Server npm install -w backend oracledb # Oracle Database
ℹ️ Visit Sequelize - Installing for more infomation.
-
Create database specified by configuration by executing
⚠️ Please, make sure you have already created a superuser for your database.npm run sqlz -- db:create
ℹ️ The command
npm run sqlz
is an alias fornpx -w backend sequelize-cli
.
Executenpm run sqlz -- --help
to see more ofsequelize-cli
commands availables. -
Optionally you can run the following command to populate your database with some dummy data:
npm run sqlz -- db:seed:all
To run the project, follow these steps:
-
Start the development server by executing the command:
npm run dev
-
Open a web browser and navigate to:
- Home page should be available at
http://localhost:3000/
. - API endpoints should be available at
http://localhost:3001/api
.
- Home page should be available at
To run tests, simply run the following command:
npm run test
The following command will build the production version of the app:
npm run start
This project is licensed under the MIT License. See the LICENSE file for details.