Skip to content

Commit 88cfe6e

Browse files
committed
chore: update readme file
1 parent 220bacd commit 88cfe6e

1 file changed

Lines changed: 79 additions & 16 deletions

File tree

README.md

Lines changed: 79 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,89 @@
1-
# Brazilian postal codes API
1+
# 🇧🇷 Brazilian Zipcode API
22

3-
An API for Brazilian postal codes, where will be available to consult the addresses by zipcode.
3+
A fast and extensible API to retrieve Brazilian address information by ZIP code (CEP), with support for multiple storage backends, TTL caching, and third-party provider integration.
44

5-
## API Endpoint
5+
---
66

7-
* GET `/zipcode/<zipcode>` Get the correspondence address based on zip code.
7+
## ✨ Features
88

9-
```shell
10-
> curl localhost:8000/zipcode/85801000
9+
- 🔍 Fetch address data using a Brazilian CEP (zipcode)
10+
- 🧠 Cache layer with configurable TTL using Redis
11+
- 🗄️ Plug-and-play support for multiple storage backends (e.g. Redis, PostgreSQL, MongoDB)
12+
- ♻️ Automatic cache invalidation and rehydration from third-party APIs (e.g. Correios)
13+
- 🧱 Clean Architecture for scalability and maintainability
14+
- 🚦 Built-in healthcheck endpoint
15+
- 🔧 Configurable via `.env` using Viper
16+
17+
---
18+
19+
## 📦 Installation
20+
21+
```bash
22+
> git clone https://github.com/felipefrizzo/brazilian-zipcode-api.git
23+
> cd brazilian-zipcode-api
24+
> go build -o zipcode-api ./cmd/*
25+
> go run ./cmd/*
26+
```
27+
28+
Server runs on :8080 by default.
29+
30+
## 🔧 Configuration
31+
32+
Create a .env file:
33+
34+
```bash
35+
PORT=8080
36+
37+
REDIS_HOST=redis
38+
REDIS_PORT=6379
39+
REDIS_USERNAME=
40+
REDIS_PASSWORD=
41+
REDIS_DB=0
42+
43+
CACHE_TTL_SECONDS=3600
44+
```
45+
46+
## 📘 API Endpoints
47+
48+
#### Healthcheck
49+
50+
```bash
51+
> curl http://localhost:8080/health
52+
```
53+
54+
#### Get Address by Zipcode
55+
56+
```bash
57+
> curl http://localhost:8080/zipcode/01001000
1158

1259
{
13-
"federative_unit": "PR",
14-
"city": "Cascavel",
15-
"neighborhood": "Centro",
16-
"address_name": "Avenida Brasil",
17-
"complement": "- de 5623 a 6869 - lado ímpar",
18-
"zipcode": "85801000",
19-
"created_at": "2020-05-22T11:56:51.735545Z",
20-
"updated_at": "2020-05-22T11:56:51.7355607Z"
60+
"federative_unit": "PR",
61+
"city": "Cascavel",
62+
"neighborhood": "Centro",
63+
"address_name": "Avenida Brasil",
64+
"complement": "- de 5623 a 6869 - lado ímpar",
65+
"zipcode": "85801000",
2166
}
2267
```
2368

24-
## License
69+
## 🧱 Architecture
70+
71+
- cmd/ — Application entry point
72+
- internal/ — Domain logic and interfaces
73+
- address/ — Domain model + repository interface
74+
- address/redis — Redis implementation of address repository
75+
- address/postgres — PostgreSQL implementation of address repository
76+
- zipcode/ — API handler
77+
- server/ — HTTP server initialization
78+
- config/ — Viper-based config loader
79+
80+
## 📈 Roadmap
81+
82+
1. Correios API integration
83+
1. PostgreSQL and MongoDB support
84+
1. OpenAPI documentation
85+
1. Rate limiting and metrics
86+
87+
## 🤝 Contributing
2588

26-
The MIT License (MIT)
89+
PRs are welcome. Ensure code is clean, covered by tests, and follows idiomatic Go practices.

0 commit comments

Comments
 (0)