How we build Vekkit
Dursztyn, Poland

A Tour Inside Our Servers

Apr 18, 2020
Distance
230 km
Climbs
4500 m
Cities
32

The Idea

Vekkit is a smart e-bike kit. What does it mean - "smart"? It means that a kit should be able to connect to the Internet via mobile applications - send statistics, update firmware, report attempts to steal the bike. Therefore, the server infrastructure is very important for us and we have spent a lot of time designing it - and now it saves a lot of our money and time. Why did we not take Google Cloud or Heroku? It's simple - we don't have subscription plans, so as the number of sold kits increases, the number of server requests and the cost of cloud servers will also increase, but our customers won't need to pay for subscription every month.

Since the project itself has a lot of applications (mobile applications for iOS and Android, firmware in the motor controller, handlebar computer and cadence sensor, web site, knowledge base, travel journal), we decided to use microservices from the very beginning.

For their deployment we use coded.sh - open-source platform which can be installed on any server with Ubuntu 18.04 and provides Continuous Delivery, Git, SSL, SSH for each microservice in 10 minutes. I developed Coded some time ago and the project was selected by Station F for acceleration, but it still remains a side project. The time saved with a properly configured CD is very large - about 10 minutes for each microservice update.

Current version

We currently have 5 microservices on the server:

  • The API microservice, which handles requests from mobile applications and frontend. Later we will also handle requests from the motor controller (after we add the LTE module to the kit). We decided to use Parse Server as a base for this microservice, which can be easily integrated into any Node.js project and helps to start working with users (registration, logins, keeping user data, photos, etc.) within one day. The second plus of Parse Server is SDKs for iOS, Android, JS, which greatly reduces the development time.
  • The MongoDB microservice. Here we store user data (from the API service) and articles for the knowledgebase and the blog. We have put the database into a separate service (container) so it can be easily scaled in the future. The Knowledge Base. Here we use Strapi.js - headless cms which allows us to create any content in a user-friendly interface and send it as JSON to frontend
  • The Website microservice (Frontend) which you see when you open vekkit.com
  • The Journal microservice - a service that is responsible for creating content for our blog. It's based on the roaded.cc project that we created for our travel stories.

Each microservice is placed in a separate container (in Coded I use Linux Containers), so if necessary we can just copy a container with a microservice to the new server and distribute the load using DNS (each microservice has its own subdomain). Despite the complexity of the infrastructure and 5 different microservices, the cost of the entire infrastructure is just 10.6 €/month (one server on Hetzner).

Plans

What we plan to add in the future:

  • Buy several servers in different regions of the world and use AnyCast DNS. For us the speed of the kit's interaction with the server is very important, as we plan to embed alerts about attempts to steal the bike and track an already stolen bike.
  • Microservice for video calls and chats to get tech help as quickly as possible. This is especially important when travelling on bicycles.

Advice

So far I develop all services and support infrastructure alone. If you also have an idea or have already developed a project on Node.js (SAAS, for example), you can easily create the same infrastructure for your project.

For this you will need:

  • To buy any server from one of the providers - DO, Vultr, Hetzner, OVH, etc. For DO and Vultr you can find coupons that will allow you to use their servers for 1 month for free. Just Google "Vultr coupons".
  • Install coded.sh on your server
  • Use open source projects for your project - Parse Server, Strapi.js, etc.

If you have any questions, feel free to contact at hey[]vekkit.com.



Private
Saved
Hey
roaded.cc/hey
Distance
230 km
Climbs
4500 m
Cities
32