You have 3 options for getting the code:
- Clone the repo
- Download the zip file
- recommended Click the "Use this template" button
Unfortunately, the only way I could get this to work is having two package.json
, and therefore 2 sets of node_modules
. Here's what you need to do after you have the code on your machine:
cd
into the skeleton directory.npm install
to install the dependencies for the Express server.cd client && npm install
to install the dependencies for the React frontend.
Let's get the database all setup!
- Follow these instructions to setup your MongoDB cluster. We're going to keep your credential string safe in a
.env
file. - Create a
.env
file in the root of the project. - Add the following line to the
.env
file, replacingYOUR_CONNECTION
with your connection string:MONGO_SRV=YOUR_CONNECTION
Now that we have the database, let's test out the app in development mode.
- From the root of the project, run
npm run dev
to start both the Express server and the React frontend. When you make changes to any files, your app will automatically update for you, so no need to rerun this command. - Open http://localhost:3000 to view the skeleton in the browser. You should see a spinning donut!
- Open http://localhost:8000/api/ to test the express server. You should see a JSON object with a message:
{message: "Hello world"}
There's not too much you need to do besides adding all your custom code. Here's a list of things you should change:
- Change the name of the app in
package.json
- Change the page title in
client/public/index.html
- Change the favicon in
client/public/favicon.ico
- [Highly encouraged] Add your own logos in
client/public/logo192.png
andclient/public/logo512.png
- Build out your API by adding routers to
server/
and importing them inapi/index.ts
- Build out your frontend by adding pages to
client/src/pages
and components toclient/src/components
and importing them inclient/src/App.tsx
- Happy hacking!
Let's deploy to vercel!
- Push your updated code to your own repo.
- Create an account on Vercel.
- Create a new project and click the "Continue with GitHub" button to link to your repo.
- Use the following settings for your project:
- Add the following environment variables:
- Click "Deploy" and wait for your app to deploy!