Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
manish committed Dec 13, 2024
0 parents commit 8f6a5f0
Show file tree
Hide file tree
Showing 190 changed files with 15,434 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/vite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Deploy VITE site to GitHub Pages
on:
push:
branches: ["main"] # Change this to your default branch if it's different
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: |
cd client # Navigate to the client folder
npm ci
- name: Check if VITE_SERVER_URL secret is available
run: |
if [ -z "${{ secrets.VITE_SERVER_URL}}" ]; then
echo "VITE_SERVER_URL is not set. Cancelling the workflow."
exit 1 # Exit the workflow if the secret is not found
fi
- name: Copy .env file
run: |
cd client # Navigate to the client folder
echo "VITE_SERVER_URL=${{ secrets.VITE_SERVER_URL}}" >> .env
- name: Build the VITE app
run: |
cd client # Navigate to the client folder
npm run build
- name: Create 404.html for routing support
run: |
cd client # Navigate to the client folder
cp dist/index.html dist/404.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./client/dist # Specify the path to the dist directory
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
178 changes: 178 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@

# MyOnlineMeals

**A Vite-based React project with admin, client, and server sections.**

MyOnlineMeals is a web application built using Vite for fast development and React for the front-end. It includes three major sections:

- **Admin Panel:** For managing meals, users, and orders.
- **Client Panel:** For users to browse meals, place orders, and make payments.
- **Server:** The backend API built with Node.js to handle server-side logic, including authentication, meals, orders, and payment processing through Stripe.

---

## Table of Contents

- [Features](#features)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Environment Variables](#environment-variables)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)

---

## Features

- **Admin Panel:**
- Manage meals, orders, and users.
- Configure payment settings with Stripe.

- **Client Panel:**
- Browse available meals, add them to the cart, and place orders.
- Integrated with Stripe for secure payment processing.

- **Server (Backend):**
- Built using Node.js and Express to handle authentication, meal data, orders, and Stripe payments.
- Uses MongoDB for storing data.

---

## Getting Started

### Prerequisites

Make sure you have the following installed:

- [Node.js](https://nodejs.org/) (v14 or higher)
- [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/)

### Installation

1. Clone the repository:

```bash
git clone https://github.com/grep-many/myonlinemeals.git
```

2. Navigate to the project directory:

```bash
cd myonlinemeals
```

3. Install dependencies for all sections:

- Admin Panel:

```bash
cd admin
npm install
```

- Client Panel:

```bash
cd client
npm install
```

- Server:

```bash
cd server
npm install
```

4. Set up environment variables for all three sections:

- **Admin & Client:**

In both `admin/.env.local` and `client/.env.local`, add the following:

```env
VITE_SERVER_URL=<your server link>
```

- **Server:**

In `server/.env.local`, add the following:

```env
MONGODB_URI=<your mongodb uri>
JWT_SECRET=<your secret key>
STRIPE_SECRET_KEY=<your stripe secret key>
FRONTEND_URL=<your client running link>
PORT=<Your Port>
```

**Note:** Replace `<your secret key>` and `<your stripe secret key>` with your actual secret keys.

5. Run the development server for each section:

- Admin Panel:

```bash
cd admin
npm run dev
```

- Client Panel:

```bash
cd client
npm run dev
```

- Server:

```bash
cd server
npm run server
```

6. Open your browser and navigate to:

- Admin Panel: `http://localhost:3000/admin`
- Client Panel: `http://localhost:5173/myonlinemeals`
- Server: `http://localhost:4000`

---

## Usage

1. **Admin Panel:**
- Allows the admin to manage meals, view orders, and configure the Stripe payment system.

2. **Client Panel:**
- Users can browse meals, place orders, and make payments using Stripe.

3. **Payment Gateway Integration (Stripe):**
- Payments are processed through Stripe in both the admin and client panels. Ensure you add your Stripe API keys in the `.env.local` file.

---

## Contributing

Contributions are welcome! Here's how you can help:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature-name`).
3. Commit your changes (`git commit -m "Added a new feature"`).
4. Push your branch (`git push origin feature-name`).
5. Open a Pull Request.
---
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
---
## Acknowledgments
- Thanks to the creators of [Vite](https://vitejs.dev/) for fast and modern development tools.
- Special thanks to [Stripe](https://stripe.com/) for their simple and secure payment processing solution.
24 changes: 24 additions & 0 deletions admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 8 additions & 0 deletions admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
38 changes: 38 additions & 0 deletions admin/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import js from '@eslint/js'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'

export default [
{ ignores: ['dist'] },
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: { react: { version: '18.3' } },
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
]
13 changes: 13 additions & 0 deletions admin/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MyOnlineMeals | Admin</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading

0 comments on commit 8f6a5f0

Please sign in to comment.