Farm Stack: Difference between revisions

From Training Material
Jump to navigation Jump to search
Line 60: Line 60:
  Async/await throughout the application
  Async/await throughout the application


Envi setup
2. Envi setup
  python3 --version
  python3 --version
  # sudo apt update ; sudo apt install python3 python3-pip python3-venv
  # sudo apt update ; sudo apt install python3 python3-pip python3-venv
Line 67: Line 67:
  # sudo apt install mongodb -y ; sudo systemctl enable mongod ; sudo systemctl status mongod ; sudo systemctl start mongod
  # sudo apt install mongodb -y ; sudo systemctl enable mongod ; sudo systemctl status mongod ; sudo systemctl start mongod


Inside the project root folder (follow the Trainer's instrs about sources)
3. Inside the project root folder (follow the Trainer's instrs about sources)
  python3 -m venv .venv            # making virtual environment in python
  python3 -m venv .venv            # making virtual environment in python
  source .venv/bin/activate        # activating it  
  source .venv/bin/activate        # activating it  
Line 74: Line 74:
  uvicorn app.main:app --reload    # Run FastAPI
  uvicorn app.main:app --reload    # Run FastAPI


Automatically generated 'RestAPI' docs in the browser
4. Automatically generated 'RestAPI' docs in the browser
  http://localhost:8000/docs        # Open 'Swagger UI' docs
  http://localhost:8000/docs        # Open 'Swagger UI' docs
  http://localhost:8000/redoc      # Alternative docs (redocly)
  http://localhost:8000/redoc      # Alternative docs (redocly)


2. DB exerc - todo
5. DB exerc - todo


3. Backend exerc - todo
6. Backend exerc - todo


4. ?
7. ?


</div>
</div>

Revision as of 10:54, 16 July 2026

THIS IS A DRAFT

This text may not be complete.


title
FARM Stack Course
author
Lukasz Sokolowski


FARM Stack Course

FARM Stack Training Materials

Overview

  • What is FARM stack?
  • FARM vs MERN

FARM acronym

FastAPI Intro

  • Fast and fast to code
    • Very high performance (like NodeJS or Go)
  • Fewer bugs and intuitive
    • Reduce of human errors, great editor support (completion, less debugging)
  • Easy and short
    • easy to use and learn (less docs),
    • plenty features from each parameter, etc
  • Robust and standards-based:
    • production-ready code, automatic interactive docs
    • OpenAPI (aka Swagger), JSON Schema, etc

Our Course Plan

In overall

  1. DAY1 - FARM intro, JS, TS, React.js
  2. DAY2 - MongoDB, FastAPI, connecting with FE (react)
    • dev envi(BE)
    • db - cli, queries, functions - MongoDB part
    • FastAPI - crud, deploying, securing, testing

Exercises for FastAPI part

Collapsed by default, some additional exercs below

1. Technology Stack

FastAPI (latest stable)
Python 3.13+
MongoDB
Motor (official async MongoDB driver)
Pydantic v2
Uvicorn
Python typing
Async/await throughout the application

2. Envi setup

python3 --version
# sudo apt update ; sudo apt install python3 python3-pip python3-venv
# todo
mongosh
# sudo apt install mongodb -y ; sudo systemctl enable mongod ; sudo systemctl status mongod ; sudo systemctl start mongod

3. Inside the project root folder (follow the Trainer's instrs about sources)

python3 -m venv .venv             # making virtual environment in python
source .venv/bin/activate         # activating it 
pip install -r requirements.txt   # installing dependencies
cp .env.example .env              # Create the '.env' file, i.e. local db config
uvicorn app.main:app --reload     # Run FastAPI

4. Automatically generated 'RestAPI' docs in the browser

http://localhost:8000/docs        # Open 'Swagger UI' docs
http://localhost:8000/redoc       # Alternative docs (redocly)

5. DB exerc - todo

6. Backend exerc - todo

7. ?