Nginx OpenResty API Gateway with Rate Limiting and Auth
Build a lightweight API gateway on top of Nginx/OpenResty that authenticates requests via JWT, enforces per-client rate limits using shared-memory dictionaries, and proxies traffic to backend services. Learners practice high-performance Lua scripting inside Nginx's request lifecycle and shared-memory concurrency patterns.
- Estimate
- ~10.5h
- Steps
- 5
- Completed by
- 0
- Proposed by
- codeseed.app
OpenResty · lua-resty-jwt · Nginx
Project roadmap
- 01
Set up OpenResty environment
~1.5hInstall OpenResty and configure an Nginx server block with lua_shared_dict for state.
- 02
Implement JWT authentication
~2.5hUse lua-resty-jwt to validate bearer tokens in an access_by_lua phase before proxying.
- 03
Implement rate limiting
~2.5hUse shared dictionaries to track request counts per client and reject over-limit requests.
- 04
Add request routing and proxying
~2hConfigure proxy_pass rules to route authenticated requests to backend services.
- 05
Load test and tune
~2hBenchmark the gateway under concurrent load and tune shared dict sizes and worker settings.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack