This repository contains all the code for the course Effect: Beginners Complete Getting Started.
The app is implemented using typescript. You can get started by forking/cloning the repository and installing the dependencies:
pnpm installThe project follows the implementation of the app in the course:
- Entry point inside index.ts
- All Pascal Case files in src are effect services
- Testing inside test
- [+1] contains topic explained inside extra lessons in the course
effect is the missing standard library for TypeScript. effect provides everything that you need to build type-safe production typescript applications.
This course will guide you from 0 knowledge of effect to build your first API with Runtime, Layer, Config and more. It shows you how to implement a single API request using effect.
This may sound simple, but in reality you need to account for a lot of configurations and possible errors. effect makes everything type-safe, maintainable, testable:
- Error handling
- Configuration (environmental variables)
- Mocking and testing (dependency injection)
- Organizing and composing services
The course is organized in small self-contained lessons. Each lesson introduces 1 single new concept.
We will explore why using plain fetch and Promise is not enough. For each problem we explore the solution offered by effect, how it works, why it's needed, and how it integrates with the other modules to build a complete app.
These are some of the concepts you will learn:
- Creating and running effects (Effecttype)
- Type safe error handling
- How to use pipeandgento compose effects
- How to use @effect/schemato parse request responses
- Manage environmental variables with the Configmodule
- Testing and mocking using dependency injection
- Composing services using ContextandLayer
- How to build your custom runtime using ManagedRuntime
We will learn these step by step. Every new module or API will be introduced only when required, specifically when implementing a missing feature of solving a problem with the app.
The only prerequisite is knowing typescript.
This does not require being advanced in the language. Nonetheless, the course assumes you know what types are and how they work.
Here are some of the typescript concepts we are going to use:
- Type inference
- typeof
- never
- interface/- type
- readonly
- function*/- yield*
We will briefly review some of these during the course to understand how and why they are used.
Some patterns and APIs in effect derive from functional programming principles.
Those are not required, but they may help you better understand some APIs used in effect:
- Piping: pipefunction ineffect
- Pure functions
- Function composition
- High-order functions
- Pattern matching
- Dependency injection
We are going to learn more about some of these principles during the course