This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass
What I Built
Are you someone who constantly judges yourself or compares your journey with others?
“Why am I not getting promoted?”
“Technology is advancing so fast. How am I supposed to keep up?”
And if you're a student, you probably know that feeling when self-doubt creeps in, when everyone seems to be doing better than you, and when you start questioning whether you're good enough.
Sometimes, we turn to our screens to escape these thoughts. We scroll, watch videos, and distract ourselves, hoping to feel a little better. But before we realise it, we've spent hours in the virtual world, disconnected from the one right outside our window.
This is where EarthLens AI comes in.
I wanted to build something that doesn't just give you another reason to stare at a screen. I wanted to build something that gently encourages you to put your phone down, step outside, and reconnect with the world around you.
Because sometimes, when life gets overwhelming, we don't need another productivity hack or another lecture about working harder. Sometimes, we just need a moment of peace.
And where can we find that peace? In the quiet shade of a tree, the resilience of a tiny plant growing through a crack, the sound of birds, or the beauty of a landscape we've walked past a hundred times without really noticing.
Nature has a way of reminding us of things we've forgotten about ourselves.
A tree doesn't compare its growth with another tree. A flower doesn't question whether it's blooming fast enough. Every living thing has its own pace, its own struggles, and its own place in this world.
EarthLens AI is my attempt to bring that connection a little closer to people who might need it most. I didn't want to create another nature-identification app that simply tells you the name of a plant and sends you back to scrolling. Here I have also added a feature of downloading the learning you get from nature and share with other on your stories and posts so that you motivate others too through your journey of Nature Lover.
I wanted the discovery itself to matter.
I wanted someone who is feeling lost, overwhelmed, or simply tired of comparing themselves with everyone else to find a reason to step outside, observe something beautiful, and pause for a moment.
We spend so much time trying to keep up with the world that we sometimes forget to actually experience it.
And perhaps nature can remind us that we don't always have to rush, compete, or have everything figured out.
EarthLens AI — Find Nature. Discover Yourself.
Because the world outside your screen has a lot more to show you than you think.
Demo
The Project is already Deployed on Vercel For Now ,
Access Link : https://earth-lens-ai.vercel.app/
I chose Vercel because of my Tech-Stack (Which is Next.Js) Best for Running Serverless Projects and I wanted to keep it free for you all.
See What EarthLens Had Created For Me! I liked it as it fit to my Mood:

Code
For The Code and documentation of the project you can check out this GitHub Repository of mine,
GitHub Repo Link : https://github.com/Vaansh-GitHub/EarthLens-Ai
How I Built It
So, let's get into the interesting part — how I actually built EarthLens AI!
I've also added a few architecture diagrams to help you understand how everything connects, because explaining a project like this only through words can get a little confusing.
When I started building EarthLens, I knew I wanted to do something with AI, but I didn't want to build just another AI chatbot or a website that identifies plants and stops there. I wanted to build something that could make people curious about the world outside their screens.
And honestly, bringing that idea to life was the interesting part.
Let's break it down!
1. The tech stack I used
Before getting into the AI part, here's a quick look at the technologies I used to build EarthLens.
- Next.js, React and TypeScript — for building the frontend and backend API routes.
- Tailwind CSS and Lucide React — for styling the interface and adding icons.
- Gemma 4 26B A4B — the vision model powering image analysis.
- Cloudflare Workers AI — to run the model without having to manage my own GPU server.
- MongoDB Atlas — for storing account-related data.
- jose and bcryptjs — for handling authentication tokens and password hashing.
- iNaturalist API — for accessing additional nature-related information.
- IndexedDB — for keeping journal entries and their images in the user's browser, in the local-storage approach.
- Vercel — for deploying the Next.js application.
I wanted to keep the setup manageable, especially since this is an open-source hackathon project. I didn't want to spend most of my time configuring infrastructure when I could be working on the actual experience.
2. The AI behind EarthLens
This is probably the most interesting part of the project.
I'm using Gemma 4 26B A4B, accessed through Cloudflare Workers AI.
Model ID: @cf/google/gemma-4-26b-a4b-it
The reason I chose a vision model is pretty straightforward: EarthLens needs to understand photographs, not just text.
Imagine uploading a picture of a tiny plant growing through a crack in the pavement. I don't want the application to simply tell you what the plant might be called and leave it at that.
I want it to help you understand what you're looking at, why it matters in nature, and what you might learn from observing it.
So, the AI workflow is designed around a few things:
- Identification: What could the uploaded image contain?
- Visual evidence: Which features of the image support that identification?
- Nature facts: What interesting information can we share about it?
- Ecological importance: Why might this organism or environment matter?
- A personal reflection: Is there an interesting characteristic that could inspire a thoughtful lesson?
- A quote and a question: Can we leave the user with something worth thinking about?
The important thing here is that the factual and reflective parts serve different purposes. Nature facts should be as accurate as possible, while personal reflections are meant to be creative and open to interpretation.
And no, the AI isn't supposed to magically know what someone is feeling just by looking at a photograph! The user's own description helps provide context for the reflection.
Also, AI can make mistakes when identifying species, particularly when the image is blurry or two organisms look similar. So, I want EarthLens to acknowledge uncertainty instead of confidently presenting every guess as a fact.
3. Why Cloudflare Workers AI instead of running my own model?
Initially, I had to think about how I would actually run the model.
I could try hosting a model myself, but that would mean dealing with GPU requirements, model-serving infrastructure, memory, deployment, and ongoing costs. For a project at this stage, that felt like a lot of extra complexity.
So I went with Cloudflare Workers AI.
The best part is that I can access the model through an API without having to maintain my own GPU machine. Cloudflare handles the inference infrastructure, while I focus on building EarthLens.
The flow is pretty simple:
- A user uploads a photograph and requests an analysis.
- The Next.js backend receives the request.
- The backend sends the image and relevant instructions to Cloudflare Workers AI.
- Llama processes the image and generates a response.
- The backend validates the response and sends the results to the frontend.
- The user sees the nature insights and reflection.
One thing I was careful about is keeping API credentials on the server. The Cloudflare token shouldn't be exposed in the browser, because that could allow someone else to misuse it.
4. Understanding the architecture
EarthLens AI — High-level system architecture
I like to think of EarthLens as four parts working together.
The frontend
This is the part users actually see and interact with.
I built it using Next.js, React, TypeScript and Tailwind CSS. Users can upload a photograph, choose the type of natural object, add their own description, and explore the results.
I wanted the interface to feel calm and inviting. After all, the point of the application is to encourage people to slow down and notice things, so a cluttered interface wouldn't make much sense.
The backend
The backend is where the important application logic lives.
Next.js API routes handle authentication, validate requests, communicate with the AI service, and manage other server-side operations.
I also need to make sure that uploaded files are validated, requests have sensible limits, and failures are handled properly. There is no point in building a beautiful interface if a malformed request or an unavailable API can break the entire experience.
The AI and external services
Cloudflare Workers AI powers image analysis, while iNaturalist can provide additional nature-related information when appropriate.
These services have different roles. The vision model helps interpret the uploaded image and generate insights, while external nature data can offer supporting references.
I don't want to treat a model's answer as automatically correct just because it sounds convincing.
The database and local storage
This part is especially important to me because I wanted to separate account information from personal nature discoveries.
MongoDB Atlas handles server-side account-related data. The local-journal approach uses IndexedDB to store journal entries and their associated images directly in the browser.
That means saved journal photographs don't need to be uploaded to MongoDB just to remain in the user's journal.
Of course, local storage comes with a trade-off: entries are tied to that browser and device, and clearing browser data can cause them to be lost. That's something worth addressing with proper export and backup options.
5. What happens when a user discovers something?
Let's walk through a typical EarthLens experience.
Step 1: Someone notices something in nature
Maybe it's a butterfly sitting on a flower, an unusual pattern on tree bark, or a small plant growing somewhere unexpected.
They take a picture and upload it to EarthLens.
I wanted the experience to begin with something people actually find outdoors, rather than asking them to sit in front of a screen and generate prompts.
Step 2: They add their own thoughts
After uploading the photograph, users can select its category and describe what they think or feel when they look at it.
This is one of my favourite parts of the idea.
Two people can look at the same tree and see completely different things. One might see strength, while another might think about patience or growth.
The user's description gives the AI some context to work with when generating a reflection.
Step 3: The backend checks the request
Before the image reaches the model, the backend should validate the file, its size, the selected category, and the text input.
It also needs to check that the required API configuration is available.
If something goes wrong, the application should return a meaningful error rather than pretending that an analysis was successful.
Step 4: The AI analyses the image
The backend sends the image to Cloudflare Workers AI in the format required by the model.
The model processes the visual information and generates the requested response.
This is where the vision capabilities come in. However, the result still depends on the quality of the photograph and what the model can recognise. A difficult image may not provide enough evidence for a reliable identification.
Step 5: The results come back to the user
Instead of showing one giant block of AI-generated text, the application can organise the response into useful sections: possible identification, visible evidence, nature facts, ecological importance, and a personal reflection.
This makes the information easier to read and helps users distinguish factual information from creative interpretation.
Step 6: The discovery becomes a memory
Once the user is happy with the result, they can save it to their nature journal.
The idea is to make these discoveries worth returning to, rather than letting them disappear as soon as the page is closed.
EarthLens also includes the concept of Nature Memory Cards, which turn a discovery into a visual keepsake that users can save or share.
6. Privacy was something I had to think about
I didn't want the journal feature to require every photograph to be stored on a remote server.
That's why the local-journal approach uses IndexedDB.
Here's the distinction:
- When a user requests an AI analysis, their selected image is sent to Cloudflare Workers AI because the model needs to process it.
- When they save a discovery to their local journal, the entry and image can be stored in IndexedDB in the browser.
- Account-related data remains separate from those locally stored journal entries.
This doesn't mean that the photograph never leaves the user's device. It does leave the device when the user requests analysis from the external AI service.
It also doesn't mean browser storage is permanent or encrypted. Local data can be lost if browser data is cleared, so a backup or export feature would be useful.
For me, the goal is to avoid storing more personal data on the application's server than the feature actually needs.
7. Authentication and security
EarthLens also needs a way to handle user accounts safely.
I'm using bcryptjs to hash passwords and jose to work with JWTs. The intended authentication flow uses an HttpOnly cookie, so the token isn't directly accessible to ordinary client-side JavaScript.
The backend also needs to verify authentication where required and validate incoming requests instead of blindly trusting data from the frontend.
Sensitive values, such as database connection strings and API tokens, belong in server-side environment variables.
These aren't particularly flashy features, but they're important. A project shouldn't focus entirely on AI functionality and forget about basic security.
8. Where does iNaturalist fit in?
Another thing worth mentioning is the iNaturalist integration.
AI models can be good at interpreting images, but identifying a particular species isn't always straightforward. Sometimes, two species look almost identical in a photograph.
That's why an external source of nature-related observations can be useful.
The idea is to use available nature data to support the discovery process when a suitable match exists. It shouldn't be treated as a guarantee that every AI identification is correct.
If the external API doesn't return a useful match, EarthLens should be able to handle that situation without inventing information or breaking the rest of the experience.
9. Deployment: getting everything online
For deployment, I'm using Vercel for the Next.js application and Cloudflare Workers AI for model inference.
The basic architecture looks like this:
User's browser → Next.js application on Vercel → Cloudflare Workers AI
Other server-side routes communicate with MongoDB Atlas and the relevant external nature API when needed.
This setup means I don't have to maintain a dedicated GPU server just to make image analysis available.
It also keeps the application relatively straightforward to deploy and update. I can improve the frontend or backend without having to manage an entire machine-learning inference server myself.
Of course, deployment still requires correct environment variables, compatible dependencies, a successful production build, and testing of the actual deployed API routes.
10. What I learned while putting this together
One thing I've realised while building EarthLens is that connecting an AI model to an application is only one small part of the job.
The harder and more interesting question is: What should the AI actually do for the person using it?
I could have stopped after making an image-identification tool. But that wasn't the experience I wanted to create.
I also had to think about the limitations of generated information, the difference between a scientific fact and a motivational reflection, how to store users' discoveries, and how to make the application useful without encouraging people to spend unnecessary time on it.
There are trade-offs everywhere.
Managed inference saves infrastructure work, but I'm dependent on an external service. Local journal storage reduces the need for remote image storage, but it introduces device and backup limitations. AI can make nature discovery more accessible, but it can also make mistakes.
I think acknowledging these limitations is part of building a better project.
Why Does Open Innovation Matter?
I think open innovation matters because good ideas shouldn't be limited by money or access to expensive tools. It gives people from different backgrounds a chance to learn, experiment, and build something of their own. Instead of everyone starting from scratch, we can learn from each other's work, improve existing ideas, and create something even better together. For students and independent developers especially, open-source tools and open AI models make it easier to turn an idea into something real. In the end, technology grows faster when we build together, share what we learn, and make it easier for others to do the same.
My Agent Session
As I had a very limited time of 2 days as i joined late so i need to rely mostly on Ai-Assisted Coding but the idea , decision, techstack selection, debugging , testing and reviewing each task were done by me.
Day 1: Building the Frontend and Backend for product:
Day 2-A: API Connections , Testing and Deployment:
Day 2-B: API Connections , Testing and Deployment:
Prize Categories
Best Use of MongoDB Atlas: MongoDB Atlas powers NatureBrain, EarthLens AI's nature knowledge retrieval system. Atlas Vector Search retrieves relevant nature facts and ecological information to help Gemma 4 26B A4B generate more grounded, informative discoveries with supporting references.
Best Use of Gemma: EarthLens AI uses Google's Gemma 4 26B A4B Instruct through Cloudflare Workers AI to analyse nature photographs, evaluate quest completion, and generate image-specific ecological insights and meaningful reflections. Gemma powers the core discovery experience, helping users connect what they observe in nature with a deeper understanding of the world around them.
What's next for EarthLens?
There is still plenty I want to explore.
I'd like to improve identification reliability, make uncertainty more visible, strengthen the supporting nature references, and provide better ways to export and back up journal entries.
I also want to keep the main idea intact as the project grows: encouraging people to discover something outdoors, learn about it, and reflect on what makes it interesting.
Technology doesn't always have to pull us deeper into the digital world. Sometimes, it can give us a reason to step away from it.
That's what I'm trying to build with EarthLens AI.
Find Nature. Discover Yourself. 🌿
Hope you liked Reading this and do tell me if any modifications are required for this.
Thanks for being with me till the end.

Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.