As the article title states, Grok AI wrote most of the code, as my expertise lies in solution architecture, So I'm writing this article to share my experience in how I used Grok AI to help me to apply my experience to build this system and enhance my hands-on experience.
I am not an expert coder, but I understand how large systems, such as social media websites, function.
Building an enterprise system requires experience in system integration and service selection within different architectures. AI can assist, but its effective use requires a strong understanding of how these systems work.
But don't worry, this article is written by me, not AI 😎😁
First, you need to list the functional requirements of your system,
Functional requirements are the core things your system should do. If we take a moment to think together about what functions a system like Twitter should have,
the first thing that comes to mind is that the user should be able to sign up for an account and log in using that account.
Also, users should be able to post and delete tweets, upload photo, love tweets, comments and retweets
I tried to cover some core features to just help you understand how we can make this happens and later on we may build on these new features
I will list the function requirements which covered by this system
- User can sign up and login
- User should be able to post tweets
- User Should be able to delete his tweets
- User should be able to love and comments on tweets
Non-functional requirments are define how system should behave
They are like
- Elasticity
- High availability
- Scalability
These requirements should enhance the user experience
The second thing you should do is your capacity estimation. This will help you pick the right resources for your system to avoid any spikes or under/high utilization.
We will not cover this here since it's a very simple system. You can search the internet; there are a lot of resources covering this. I will drop some links below 😁 ✌
High level Design & Components
I picked AWS since this is my area i
Of expertise and used common services for building the system
Below is a breakdown of the services I used:
- EC2 instance: To host our frontend code and act as a web server.
- API Gateway: Built APIs used for signup, login and authorization, posting tweets, deleting tweets, liking tweets, and commenting. Each function has its own URL and Lambda function.
- Lambda Functions: Contain the logic for the system functionality mentioned above.
- DynamoDB: Contains Users and Tweets tables that store the data.
Sequence Diagrams
Login Flow
Post Tweet Flow
Love Tweet
Love Tweet, Comment & Delete Tweet they are all the same in terms of getting tweet_id and perform the action
Some screenshots of the UI:
Code
And now for the interesting part, I uploaded a code on Github
feel free to use it and remember this is a very basic code, Further enhancements are coming 😁
Final Words
I know best practices are not applied here and many features are missing such as decoupling the components, caching service and following/followee system and the system looks dummy that cannot handle heavy workloads 😢🤦♀️, but it should give you a vision of how larger systems should work, and you can consider it a start.
And you can make magic happen If you know the way and how you can interact with AI.
I hope this article helped you to understand a little about how you can make use of AI tools and how you can build a system by help of these tools, I will try to work on this base version for further enhancement and features and I may create another article to include these enhancements.
Will be happy to see your comments and suggestions 😃
Top comments (2)
Thanks for sharing this, I liked how you used Grok Ai, it's nice to know about it as it looks promising.
❤️