π°Good News app is a fully open source project created exceptionally for educational purposes. It contains backend (you can see the response of it if you open this link https://api.good-news.ggc.team/v1/news/
) written in Golang, iOS & Android mobile apps (which I will publish to App Store and Google Play) made with Flutter and frontend made with Hummingbird (Flutter for web). Links to repositories for code of mobile apps and frontend will be added later when as soon as I finish working on them. My code is not going to be perfect due to the fact that I am not a super professional in any of those topics but I will do my best, promise βοΈ I am a supporter of an idea of sharing knowledge with the world because it is always good to share what you have learnt with those who might struggle with the same issues you faced and by doing it I will learn something new as well. WIN-WIN strategy.
I am in process of writing chapters divided to articles on Medium. Below you will find links to them. They will be updated as I finish working on them.
Introductory article - here you will find all the introductory information and links to other chapters as well.
All chapters of a "book":
- π° Good News app. Backend in Golang behind Traefik reverse proxy with https available.Β
- [in progress] π° Good News app. Flutter for rapid mobile applications development.
- [in progress] π° Good News app. Hummingbird as a promising replacement for frontend frameworks.
And here are articles of current chapter (repository):
- Prerequisites & Idea, project and database structure and API endpoints.
- Project creation, go modules & GIN (beautiful framework) integration.
- Colly usage.
- MongoDB setup using official Golang driver.
- Running all together locally with Docker and Docker Compose & Traefik v2.0 configuration.
- Publishing to Digital Ocean, Let's Encrypt and DNS Challenge configuration.
In order to launch this project locally, you have to have Golang and Docker installed on your machine.
NOTICE: code in this repository is not a final version of what I have been telling in my articles. For example, if you would like to know how to publish this project on Digital Ocean droplet behind Traefik reverse proxy with https available on your own domain, you will need to follow all articles above.
First of all, you have to cd
to where your $GOPATH
is pointing to on your machine, then cd
to $GOPATH/src/github.com/<your_github_or_any_username>
. After that, you will clone this repository, cd
to it and run it with Docker Compose. Please, make sure that your Docker is launched successfully while following steps below.
So the steps are:
> cd ~/go/src/github.com/kanzitelli/
- might be different from yours depending on your$GOPATH
and username. In order to check where$GOPATH
is pointing to, please typego env
in terminal and you will find it in the beginning of the printed list.> git clone https://github.com/kanzitelli/good-news-backend.git
> cd good-news-backend/
> docker-compose build && docker-compose up -d
- ... wait for some time till whole process is finished
- open a browser window and go to
localhost:6969/v1/news/sources
. You should see nothing, right. Because we need to configure MongoDB as well π > docker exec -it mongo mongo -u "GGCTeamBatr" -p "MySuperSecretPassword" --authenticationDatabase admin
- to open shell of mongo db running within our docker container> use good_news_db
- so we change (create) to needed db> db.createUser({user: 'suuuper_user', pwd: 'soop3r_U$eR_PSWD', roles:[{role:'dbOwner', db:'good_news_db'}]})
- creating a super user> db.test_collection.insert({ test: "test" })
- inserting test data to test collection> show collections
- displaying all collections of our previously created db in order to make sure that our test collection was successfully created> exit
- saying goodbye to mongo shell> docker ps
- to show all running docker containers. FindCONTAINER ID
(first column) of container namedapi
.> docker stop <api_contrainer_id>
- to stop api container. We will rerun it in the next step.> docker-compose build && docker-compose up -d
- to rebuild our docker container with new settings applied to MongoDB.- all credentials for MongoDB should be the same with those which are located in
.env
file in the root of the project (in case if you would like to change them) - so now you can open a browser window and go to
localhost:6969/v1/news/sources
. Now you should see news sources which are pre-filled before server launch. After 3 minutes, you will be able to see first news gathered from parsing news sites by openinglocalhost:6969/v1/news
. Why 3 minutes? Follow my articles on Medium to understand that π
If you have any comments or suggestions, please feel free to email me at [email protected] π If you would like to know when I post new articles, follow me on twitter π¦