48 lines
2.0 KiB
Markdown
48 lines
2.0 KiB
Markdown
# Blog
|
|
|
|
## Development
|
|
|
|
- Frontend: Typescript (Next.js)
|
|
- Backend: Go (gqlgen)
|
|
- Database: PostgreSQL
|
|
|
|
Despite Next.js being a full-stack framework, I still decided to adopt a separate front-end and back-end architecture for this blog project. I believe that this separation makes the project cleaner, reduces coupling, and aligns with modern development practices. Furthermore, I wanted to practice developing a purely back-end API.
|
|
|
|
As for the more detailed development approach, I plan to use Clean Architecture for the overall structure and ATDD for testing. Of course, such a small project may not necessarily require such complex design patterns, but I want to give myself an opportunity to practice them.
|
|
|
|
These will allow me to become more proficient in these modern development practices and leave a lot of flexibility and room for adjustments in the future.
|
|
|
|
## Environment
|
|
|
|
### Database Instance
|
|
|
|
Using docker to run a database instance.
|
|
|
|
```bash
|
|
podman run -d -p 127.0.0.1:5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --rm --name postgres --replace postgres:alpine
|
|
```
|
|
|
|
For more infomation, please refer to [PostgreSQL Docker Hub](https://hub.docker.com/_/postgres).
|
|
|
|
### Database Migration
|
|
|
|
Using golang-migrate to manage database migration.
|
|
|
|
- Create a new migration file
|
|
|
|
```bash
|
|
migrate create -ext sql -dir backend/internal/framework/db/postgres/migration -seq migration
|
|
```
|
|
|
|
- Run migration
|
|
|
|
```bash
|
|
migrate -path db/migrations -database "postgresql://postgres@localhost:5432/postgres?sslmode=disable" up
|
|
```
|
|
|
|
For more information, please refer to [golang-migrate GitHub](https://github.com/golang-migrate/migrate/tree/master/cmd/migrate).
|
|
|
|
## License
|
|
|
|
This project uses a combination of the [MIT License and a custom license](./LICENSE.md). Based on the MIT License, anyone is permitted to use the code. However, before deploying the code, they must first replace any information belonging to "me" or any content that could identify "me," such as logos, names, and "about me" sections.
|