Where KisanX started

KisanX began as an answer to a problem that's easy to state and hard to fix: Indian farmers lose a meaningful chunk of their income to middlemen, and there's very little digital infrastructure built specifically to give them direct access to customers. I co-founded the project with that problem in mind, and the first version we shipped was nowhere near as polished as what exists today. It was PHP, MySQL, and a lot of trial and error.

Why I started with PHP, not MERN

If you only looked at my current stack, you might assume KisanX was MERN from day one. It wasn't, and that was deliberate. When you're validating whether an idea even works, the goal isn't to pick the most modern stack — it's to get something real in front of people as fast as possible. PHP and MySQL let me do that. I already understood server-side scripting, session-based auth, and relational data modelling well enough to move quickly, so Phase 1 of KisanX was a full e-commerce flow: product listings, cart, wishlist, checkout, and order tracking, all running on a classic PHP backend.

That version did exactly what it needed to do. It proved farmers and buyers could use a direct marketplace flow without confusion, and it gave us something concrete to show at Avishkar, the University of Mumbai's inter-collegiate research convention, where KisanX was eventually selected in the Agriculture & Animal Husbandry category.

Where the PHP version hit its ceiling

The cracks showed up once I started thinking about a mobile app. PHP with session-based authentication works fine for a server-rendered website where the browser holds onto a cookie, but it doesn't translate cleanly to a mobile client that needs to manage its own auth state, work offline-ish, and talk to an API rather than render server-side HTML. Trying to force session auth into a React Native app would have meant fighting the architecture instead of building the product.

There was also a data-modelling argument. The web version's relational schema worked well for orders and inventory, but as soon as I started sketching what a richer dashboard and more flexible product catalogue would need, a document-based model started to make more sense — especially for data that didn't fit neatly into fixed columns.

Rebuilding the backend in MERN

So Phase 2 became a full rebuild: MongoDB for the database, Express.js and Node.js for the API layer, and React on the frontend conceptually (though the real frontend effort went into the mobile app, which I'll get to). I designed RESTful endpoints for users, products, cart, orders, wishlist, and dashboard data, mirroring the functionality from Phase 1 but built around stateless authentication instead of sessions.

One thing I didn't expect going in: a surprising amount of the "rebuild" was really a redesign. Moving from MySQL to MongoDB isn't a drop-in replacement — you end up rethinking which data should be embedded versus referenced, and how to structure documents so queries stay fast as the product catalogue grows. I spent more time on schema design for the Mongoose models than I initially budgeted for, and in hindsight that was time well spent.

Building the React Native app

The mobile app is where Phase 2 really came alive. I used React Native with Expo, partly because Expo's tooling makes it much easier to test on a real device without fighting native build configuration, which mattered a lot given I was building this around coursework, not as a full-time job. The app needed to support browsing products, managing a cart and wishlist, placing orders, and a basic dashboard view — functionally similar to the PHP version, but with a noticeably more modern UI and smoother interactions once everything was wired up to the new API.

Styling and UI consistency across a mobile app is a different discipline from web CSS. I spent real time on things like safe-area handling, consistent spacing across screen sizes, and making sure navigation felt native rather than like a web page wrapped in an app shell.

JWT, OTP, and getting authentication right

This was the part I was most careful about, partly because of the Python for Cyber Security coursework I'd done and partly because mobile auth has more failure modes than web auth if you're not deliberate. The mobile app authenticates using JWT tokens issued by the Node.js backend, which the app stores and attaches to every subsequent API request instead of relying on cookies. On top of that, I added OTP verification at sign-up, so a phone number has to be confirmed before an account becomes fully active.

Passwords are hashed before they ever touch the database, and I went back over every write endpoint to make sure input was validated and sanitised server-side, not just on the client. None of this is exotic — it's standard practice — but actually implementing it correctly, end to end, in a project I was fully responsible for, taught me more about secure auth than any course reading did. I wrote a more detailed breakdown of the JWT and OTP flow specifically in this follow-up article, if you want the implementation details.

Deploying on Render

A backend that only runs on your laptop isn't a backend, it's a demo. I deployed the Node.js API on Render, which gave KisanX a publicly reachable, production-style environment instead of something I had to spin up manually every time someone wanted to test the app. Getting environment variables, CORS configuration, and the MongoDB connection string set up correctly for a hosted environment (as opposed to local development) was its own small learning curve, but it was the difference between a project that lives in a GitHub repo and one that's actually usable.

What I'd do differently

If I were starting KisanX today, I'd probably still build the PHP version first — it genuinely was the fastest way to validate the idea, and I don't think skipping straight to MERN would have saved time overall. Where I'd change things is in the rebuild itself: I'd plan the MongoDB schema before writing any API code, instead of iterating on it as the mobile app's needs became clearer. A bit more upfront design would have saved a few painful migrations later.

What I'm most glad about is that KisanX never stayed a "tutorial project." Every decision — PHP first, then MERN, then JWT over sessions, then Render over a local server — came from an actual constraint, not from following a roadmap. That's also the reason it ended up presentable enough to take to Avishkar.

If you want to see the rest of the architecture, including the full database design and API structure, the KisanX project page has the complete breakdown. And if you're weighing PHP against MERN for your own project, I wrote about that trade-off directly based on this exact experience.