Web Development
Python Basics: Build a Secure CRUD API with FastAPI
Go from Python fundamentals to a working, secure REST API with FastAPI and PostgreSQL in two hands-on days. No coding experience needed.
- Beginner
- 2 days
- HRD Corp claimable
Overview
This 2-day hands-on course introduces participants to Python programming and FastAPI, a modern framework for building high-performance web APIs.
Participants start with Python fundamentals, then build a working CRUD API connected to a PostgreSQL database, step by step. By the end, they will have built a secure API with validation, error handling, pagination and login authentication — and tested every endpoint in Swagger UI.
Delivery is face-to-face and instructor-led: about 30% theory and 70% hands-on coding, with guided labs, live demonstrations and Q&A. Participants bring their own laptops.
The course suits beginners interested in programming and backend development, IT staff, fresh graduates and students who want practical coding skills, and non-developers who want to understand how web APIs and databases work. If you were looking for a kursus Python for beginners that ends with something you built, this is it. Participants leave with a complete, working FastAPI project, the slides and lab guide, source code for every exercise and a Certificate of Completion.
Join a public session, or run it in-house for your team as a face-to-face course. It is HRD Corp claimable, subject to grant approval; see how HRD Corp claims work.
After the course
Python Intermediate builds directly on this course, adding local AI and a full RAG application, and Docker Essentials shows how to package and deploy the API. To test the API and the screens around it, see Playwright: End-to-End Testing.
Schedule is tentative and subject to change based on the trainer’s delivery, participants’ progress, and training needs.
What you’ll learn
- Write basic Python programs using variables, conditions, loops and functions
- Set up a Python development environment with VS Code
- Build and run a FastAPI application
- Connect an API to a PostgreSQL database using SQLAlchemy
- Create CRUD endpoints to add, view, update and delete data
- Validate input data and handle errors properly
- Secure an API with login authentication (API Key and JWT)
- Test endpoints using the built-in Swagger UI
Who should join
- Beginners interested in programming and backend development
- IT staff, fresh graduates and students who want practical coding skills
- Non-developers who want to understand how web APIs and databases work
Prerequisites: No prior programming experience required. Participants need basic computer literacy (managing files and folders, browsing the internet) and a laptop they can install software on (admin rights). Please install Python 3.11+ and VS Code with the Python extension before Day 1.
Course modules
-
01 Python Refresher
Data types, f-strings and type conversion, control flow, functions, lists, tuples, dicts and sets, classes and inheritance, and type hints — the Python features FastAPI, SQLAlchemy and Pydantic are built on.
-
02 Environment Setup & Your First FastAPI App
What an API is (client, server, request, response, JSON), virtual environments, pip and requirements.txt, VS Code interpreter setup, HTTP methods, and running a FastAPI app with Swagger UI at /docs.
-
03 Project Structure, Routing, Path & Query Parameters
Organising a project into main, models, schemas, crud and routers; route decorators; path vs query parameters; optional and default parameters; and automatic type validation (422 errors).
-
04 PostgreSQL Database Setup
Relational database concepts, installing PostgreSQL and pgAdmin, creating a database and user, basic SQL, connection URLs, and Docker as an alternative.
-
05 ORM Models with SQLAlchemy & Migrations with Alembic
What an ORM is; engine, session and Base; defining models with Mapped and mapped_column; the get_db dependency; and managing schema changes with versioned Alembic migrations.
-
06 Schemas with Pydantic
Separating database models from API schemas; Create, Update and Out schemas; optional fields for partial updates; from_attributes; and response_model — controlling exactly what the API accepts and returns.
-
07 CRUD Operations
Create, read, update and delete functions; add, commit and refresh; dependency injection with Depends; status codes (200, 201, 204, 404); and wiring APIRouters into the app.
-
08 Data Validation, Error Handling & Pagination
Field constraints and custom validators, reading 422 responses, HTTPException and custom exception handlers, skip/limit pagination, and filtering and ordering results.
-
09 Authentication (API Key & JWT)
Authentication vs authorisation, API keys in headers, password hashing, registration and login, JWT structure and expiry, OAuth2PasswordBearer, get_current_user, and protecting routes in Swagger.
-
10 Environment Settings & Hands-on Project
Keeping secrets out of code with .env files and pydantic-settings, .gitignore and .env.example, and dev vs production config. Hands-on project: build a secure Book Library CRUD API, then extend it with a Members resource featuring validation, pagination and JWT-protected endpoints.
FAQ
+ Is this course HRD Corp claimable?
Yes, subject to your grant approval. Tarsoft is a registered training provider and will help with the application.
+ Do I need to know how to code?
No. Day 1 starts with a Python refresher and the course assumes no prior programming experience.
+ What do I take home?
A complete, working FastAPI project, the training slides and step-by-step lab guide, source code for all exercises, and a certificate of completion.
+ What comes next?
Python Intermediate builds directly on this course, adding local AI and a full RAG application.
Related courses
Python Intermediate: Secure AI Apps with FastAPI & Ollama
Build a secure RAG assistant that answers questions from your own documents — running 100% on your laptop, with no cloud and no API keys.
- 3 days
- Intermediate
Regular price RM2,000 Early-bird price RM1,800 / pax Early bird
Book 14+ days ahead; RM2,000 regular
Docker Essentials: Package, Ship & Deploy Your Apps
Containerise your applications and deploy them the same way every time, from your laptop to the server — in one hands-on day.
- 1 day
- Beginner
RM1,400 / pax