Skip to content

Mojarung/vtb_mortech_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Auth/User Example

Setup

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload

User Model

Users now have comprehensive profiles with:

  • Required fields: username, email, password
  • Optional fields: about, phone, birth_date, skills, education
  • System fields: id, is_active, created_at

Endpoints

Authentication

  • POST /auth/register - Create new user

    {
      "username": "john_doe",
      "email": "[email protected]", 
      "password": "secret123",
      "about": "Software developer",
      "phone": "+1234567890",
      "birth_date": "1990-01-01",
      "skills": "Python, FastAPI, SQL",
      "education": "Computer Science Degree"
    }
  • POST /auth/login - Login with username/email + password

    • Query params: username (can be username or email), password

User Management

  • GET /users/me - Get current user profile (Authorization: Bearer )
  • PUT /auth/me - Update current user profile (Authorization: Bearer )
  • GET /users - List all users (Authorization: Bearer )
  • GET /users/{user_id} - Get specific user (Authorization: Bearer )

Environment

  • APP_DATABASE_URL: default sqlite+aiosqlite:///./app.db
  • APP_SECRET_KEY: set a strong key
  • APP_ACCESS_TOKEN_EXPIRE_MINUTES: default 1440

Database

The app uses SQLite by default. If you need to recreate the database after schema changes:

rm -f app.db
uvicorn app.main:app --reload

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •