Skip to content

Shariq2003/FastAPI_Control_Panel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI X React ERP Application

This project is a full-stack application with React as the frontend and FastAPI as the backend. It includes user registration, login, and management features, with role-based access control (RBAC) for normal users and admins.

Table of Contents

Setup Instructions

  1. Clone the Repository

    git clone https://github.com/Shariq2003/FastAPI_Control_Panel.git
    cd <repository-folder>
    

Setup Backend

  1. Create a virtual environment

    python -m venv venv
    venv\Scripts\activate //For Windows
    source venv/bin/activate // For Linux/mcOS
    
  2. Install dependencies

    pip install -r requirements.txt
    
  3. Update environment variables

    • Rename .env.example to .env.
    • Update the .env file with your specific configuration.
  4. Set CORS origins

    • main.py: update the origins list to include the URLs you want to allow access from, such as your frontend's URL.
  5. Start the backend server

    uvicorn app.main:app --reload
    

Setup Frontend

  1. Install dependencies

    npm i
    
  2. Update environment variables

    • Rename .env.example to .env.
    • Update the .env file with your backend URL and other configurations
  3. Start the Front server

    npm run devStart
    

Project Structure

Backend

  • app/main.py: Main entry point for the FastAPI application.
  • app/models.py: Defines the database models.
  • app/schemas.py: Defines Pydantic schemas for request and response data.
  • app/crud.py: Contains CRUD operations for interacting with the database.
  • app/auth.py: Handles authentication and token creation.
  • app/database.py: Configures database connection and session management.

Frontend

  • frontend/src/: Contains React components and application logic.
  • frontend/src/components/RegistrationForm.jsx: Handles user registration.
  • frontend/src/components/LoginForm.jsx: Handles user login.
  • frontend/src/components/UserTable.jsx: Displays user data and allows admins to manage users.
  • frontend/src/components/AdminActions.jsx: Provides admin actions such as adding users.
  • frontend/src/App.jsx: Main application component and routing setup.
  • frontend/src/index.js: Entry point for the React application.
  • frontend/.env.example: Example environment file for frontend configuration.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published