Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Recipes App: MERN Starter Code

A small full-stack recipes app used as starter code for the AI implementation lesson. You can list recipes, view a recipe's details, and create new recipes by filling in a form.

Technologies

  • Client: React, React Router, Axios, Vite, TypeScript
  • Server: Node.js, Express, Mongoose (MongoDB), TypeScript

Project structure

.
├── client/                     # React app (Vite)
│   ├── index.html
│   ├── vite.config.ts
│   └── src/
│       ├── main.tsx            # Entry point, sets up BrowserRouter
│       ├── App.tsx             # Routes
│       ├── components/         # Navbar
│       ├── pages/              # RecipeListPage, RecipeDetailsPage, RecipeCreatePage
│       ├── services/           # Axios instance (config.services.ts)
│       └── types/              # Shared TypeScript types (Recipe)
│
└── server/                     # Express API
    └── src/
        ├── server.ts           # Starts the server
        ├── app.ts              # Creates the Express app
        ├── config/             # Global middleware (CORS, logger, body parsers)
        ├── db/                 # MongoDB connection
        ├── errors/             # 404 and error handlers
        ├── models/             # Recipe model
        └── routes/             # API routes, mounted under /api

API endpoints

Method Endpoint Description
GET /api/recipes List all recipes (title only)
GET /api/recipes/:recipeId Get one recipe with all its details
POST /api/recipes Create a recipe

Running locally

You need Node.js 24 or later and a running MongoDB instance.

1. Server

cd server
npm install

Create a server/.env file based on server/.env.example:

PORT=5005
ORIGIN=http://localhost:5173
MONGODB_URI=mongodb://127.0.0.1:27017/recipes-db

Start the server in development mode:

npm run dev

2. Client

In a second terminal:

cd client
npm install

Create a client/.env file based on client/.env.example:

VITE_SERVER_URL=http://localhost:5005

Start the client:

npm run dev

Open http://localhost:5173 in your browser.

Other scripts

Folder Command What it does
server npm run build Compiles TypeScript into dist/
server npm start Runs the compiled server from dist/
client npm run build Type-checks and builds the app into dist/
client npm run lint Runs ESLint

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages