<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ishika Thakur</title>
    <description>The latest articles on DEV Community by Ishika Thakur (@ishika1435).</description>
    <link>https://dev.to/ishika1435</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4214911%2F92f2bf48-9613-483f-a974-78118a38f125.png</url>
      <title>DEV Community: Ishika Thakur</title>
      <link>https://dev.to/ishika1435</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ishika1435"/>
    <language>en</language>
    <item>
      <title>Letting AI assistants draft posts, but never publish them: building an MCP server with its own OAuth 2.1 server</title>
      <dc:creator>Ishika Thakur</dc:creator>
      <pubDate>Tue, 24 Nov 2026 20:59:20 +0000</pubDate>
      <link>https://dev.to/ishika1435/letting-ai-assistants-draft-posts-but-never-publish-them-building-an-mcp-server-with-its-own-5397</link>
      <guid>https://dev.to/ishika1435/letting-ai-assistants-draft-posts-but-never-publish-them-building-an-mcp-server-with-its-own-5397</guid>
      <description>&lt;p&gt;I'm building SocialPost, a multi-tenant social media management platform for Facebook and Instagram, during my internship. It will be used in-office for real clients.&lt;/p&gt;

&lt;p&gt;The newest piece is an MCP server, so an AI assistant (like Claude) can work with SocialPost on behalf of a user. It is finished and off by default. This post covers the three decisions that mattered most.&lt;/p&gt;

&lt;h2&gt;
  
  
  What MCP is, in one paragraph
&lt;/h2&gt;

&lt;p&gt;The Model Context Protocol (MCP) is a standard way for an AI assistant to connect to an outside app and use its tools. For SocialPost, that means an assistant can look at a client's calendar, brand profile and recent posts, and then write a draft post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 1: the AI can draft, but people stay in charge
&lt;/h2&gt;

&lt;p&gt;In SocialPost, a post moves through drafts, review, approval and scheduling. Real people approve it. I wanted the AI to fit into this flow, not skip it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So an agent can:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;read clients, posts, the calendar, analytics, connected accounts and the media library&lt;br&gt;
create and edit drafts&lt;br&gt;
submit a draft for approval&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An agent can never:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;approve a post&lt;br&gt;
publish a post&lt;br&gt;
delete a post&lt;/p&gt;

&lt;p&gt;These are not settings. The tools simply don't exist. An AI can't be talked into doing something it has no tool for. A person always makes the final call.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 2: check the plan before writing code
&lt;/h2&gt;

&lt;p&gt;Before writing any code, I spent a whole milestone (I called it M0) auditing my own codebase. No changes, only questions: what do I already have, and what is really new?&lt;/p&gt;

&lt;p&gt;The good news was that users, roles, client isolation, history, rate limiting and hashing could all carry agents with small hooks. The real new work was the OAuth server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 3: build the OAuth server myself
&lt;/h2&gt;

&lt;p&gt;For an AI assistant to act for a user, the user has to sign in and give permission. MCP uses OAuth 2.1 for this. There are two ways a client can introduce itself to the server:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DCR (Dynamic Client Registration)&lt;/strong&gt;: every client registers itself first. The MCP spec now treats this as deprecated.&lt;br&gt;
CIMD (Client ID Metadata Documents): the client's ID is a URL that points to a document describing it. This is the direction the spec is going.&lt;/p&gt;

&lt;p&gt;I wanted CIMD, not only DCR. My plan was Spring Authorization Server, with a 1-2 day spike to test it. It didn't support CIMD, so I built my own OAuth 2.1 server instead. Finding that out early, on paper, was the point of the audit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the OAuth server does:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PKCE with S256 on every authorization&lt;br&gt;
Short-lived access tokens (15 minutes)&lt;br&gt;
Refresh tokens that rotate, stored only as hashes&lt;br&gt;
Reuse detection: if an old refresh token is used again, the whole chain is revoked, because that suggests it was stolen&lt;br&gt;
Checks on every call: each tool call re-checks that the user still has access, so removing someone takes effect right away&lt;/p&gt;

&lt;p&gt;There was one more wrinkle. The SocialPost web app keeps its login token in the browser and has no server session, so I needed a small consent step to connect "the person logged in" with "the assistant asking for access".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fezt2dxhwhgdispa0i4wq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fezt2dxhwhgdispa0i4wq.png" alt="MCP DIAGRAM" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Audit first&lt;/strong&gt;. A milestone of reading my own code saved me from building on a wrong assumption.&lt;br&gt;
&lt;strong&gt;Limit what the AI can do by design.&lt;/strong&gt; Leaving the dangerous tools out is simpler and safer than trying to block them later.&lt;br&gt;
&lt;strong&gt;A library can be the wrong choice.&lt;/strong&gt; Spring Authorization Server is good, but it didn't fit this requirement, and a short spike showed that quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;I'm now working on a WhatsApp channel, so teams can draft and approve posts from chat. I'll write about that once it's built.&lt;/p&gt;

&lt;p&gt;If you've built an MCP server or an OAuth flow, I'd like to hear what surprised you. Leave a comment.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>java</category>
      <category>springboot</category>
    </item>
    <item>
      <title>Building SocialPost: a multi-tenant social media platform, built end to end during my internship</title>
      <dc:creator>Ishika Thakur</dc:creator>
      <pubDate>Thu, 19 Nov 2026 13:30:08 +0000</pubDate>
      <link>https://dev.to/ishika1435/building-socialpost-a-multi-tenant-social-media-platform-built-end-to-end-during-my-internship-33oa</link>
      <guid>https://dev.to/ishika1435/building-socialpost-a-multi-tenant-social-media-platform-built-end-to-end-during-my-internship-33oa</guid>
      <description>&lt;p&gt;Social post is a social media management platform for Facebook and Instagram, made for agencies that run several client brands at once. In this post I'll walk through the problem, how a post moves through the system, the technology behind it, and a few decisions I'm proud of. I'll also be honest about what isn't finished.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzrpd4gdih9zqt5stapga.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzrpd4gdih9zqt5stapga.png" alt="Dashboard of a test account" width="799" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The problem
&lt;/h2&gt;

&lt;p&gt;An agency running social media for several brands needs one place to create posts, get them approved by the right people, schedule them and publish them. Without that, captions live in chats, nobody is sure what has been approved, and a wrong post on a client's account is public and hard to undo.&lt;/p&gt;

&lt;p&gt;SocialPost puts that whole workflow in one system.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. How a post moves through the system
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;creator&lt;/strong&gt; writes a draft with media, a caption for each platform, and an optional first comment.&lt;/li&gt;
&lt;li&gt;They submit it, and it goes to &lt;strong&gt;audit review&lt;/strong&gt;, which needs approvals from N of M distinct auditors.&lt;/li&gt;
&lt;li&gt;If the client requires it, an &lt;strong&gt;admin&lt;/strong&gt; approves next, then the &lt;strong&gt;client&lt;/strong&gt; can approve too.&lt;/li&gt;
&lt;li&gt;Once approved, it has a scheduled time, and the &lt;strong&gt;scheduler&lt;/strong&gt; publishes it.&lt;/li&gt;
&lt;li&gt;It ends as posted, partially posted or failed. Any reviewer can reject it along the way.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The approval rules are set per client. When a post is submitted, the rules are copied onto it, so a post already in review keeps its rules even if the client's approval flow is edited later.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft4b766jme5ac728xc6s0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft4b766jme5ac728xc6s0.png" alt="Published Post page of a test account" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What it does
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Content calendar with month and week views and rescheduling&lt;/li&gt;
&lt;li&gt;Post composer with per-platform captions, first comments, Reels and Instagram collaborators&lt;/li&gt;
&lt;li&gt;Media library per client, with tags and reuse&lt;/li&gt;
&lt;li&gt;Customisable approval flow per client&lt;/li&gt;
&lt;li&gt;Automatic scheduled publishing, with retry for a failed destination&lt;/li&gt;
&lt;li&gt;Internal discussion on each post, with @mentions and full revision history&lt;/li&gt;
&lt;li&gt;Reading and moderating Facebook and Instagram comments&lt;/li&gt;
&lt;li&gt;Daily-synced analytics and insights&lt;/li&gt;
&lt;li&gt;In-app notifications and queued emails&lt;/li&gt;
&lt;li&gt;Invitations, password reset and bulk actions&lt;/li&gt;
&lt;li&gt;Optional AI writing helpers, and an MCP server for AI assistants (more on that below)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Many clients, one platform
&lt;/h2&gt;

&lt;p&gt;SocialPost is multi-tenant. There are five roles: creator, auditor, admin, super admin and client. Every client-scoped request has to declare which client it is for, and the backend refuses it unless the person is allowed to act for that client. Method-level permission rules back this up in the service layer, so they hold no matter which screen or API call triggers an action.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The technology
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend:&lt;/strong&gt; Java 17, Spring Boot 3.5, Spring Security, Spring Data JPA&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; PostgreSQL 16 with Flyway, and Redis 7&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Media:&lt;/strong&gt; Cloudflare R2 and Cloudinary&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; React 19 with Vite, React Router and Recharts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delivery:&lt;/strong&gt; Docker, GitHub Actions, Nginx, and Sentry for monitoring. I wrote about the pipeline in &lt;a href="https://dev.to/ishika1435/how-i-set-up-cicd-with-automatic-rollback-on-a-shared-vps-18dc"&gt;https://dev.to/ishika1435/how-i-set-up-cicd-with-automatic-rollback-on-a-shared-vps-18dc&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Engineering decisions I'm proud of
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Never publish twice.&lt;/strong&gt; Publishing a post is split into three steps: claim the job, call Meta, record the result. Each step is committed separately, and no database transaction stays open while calling Meta. If a job's outcome is unclear, for example after a timeout, it goes to manual review and is never retried automatically. A person occasionally has to check a post, and that's a deliberate trade-off against ever publishing the same post twice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One backend instance, on purpose.&lt;/strong&gt; A single backend container runs the scheduler. Running two side by side would risk double publishing, so I accepted a short restart gap on each deploy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Migrations only add.&lt;/strong&gt; A rollback restores the old app but not the old database, so migrations may only add things, and CI enforces it. Renaming or dropping a column takes two or three releases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;People stay in charge of AI.&lt;/strong&gt; The MCP server lets assistants like Claude read the calendar, plan content and create drafts. Assistants run as the signed-in person through the same services the web app uses, are limited by that person's role, and have no tools to publish, approve or delete. MCP clients need Client ID Metadata Documents, which Spring Authorization Server didn't support, so I built my own OAuth 2.1 server with PKCE required, short-lived tokens, and refresh tokens that rotate.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Problems that taught me the most
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Surviving crashes.&lt;/strong&gt; Jobs stuck in processing are recovered after 15 minutes, and a circuit breaker stops calling a platform that keeps failing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Facebook Stories.&lt;/strong&gt; Meta says Story media can't have been used before, without defining what counts, so the fix re-encodes a separate copy for the Story.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OAuth connect flows.&lt;/strong&gt; The state value is single-use, tied to a browser cookie and consumed atomically. If Redis is down, the flow fails closed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token health.&lt;/strong&gt; Social account tokens are checked daily, and the app warns before publishing starts failing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  8. By the numbers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;53 database migrations and about 40 tables&lt;/li&gt;
&lt;li&gt;37 REST controllers and 13 scheduled jobs&lt;/li&gt;
&lt;li&gt;43 frontend pages&lt;/li&gt;
&lt;li&gt;Over 1,600 backend tests and 438 frontend unit tests&lt;/li&gt;
&lt;li&gt;128 commits since April&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  9. What isn't finished
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;There are no end-to-end tests yet, and no coverage tool.&lt;/li&gt;
&lt;li&gt;The client approval view is read-only for now, and a "changes requested" outcome doesn't exist yet.&lt;/li&gt;
&lt;li&gt;Encryption key rotation is designed but not done.&lt;/li&gt;
&lt;li&gt;Facebook Stories made from a Feed post still need confirming on a real page.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I'm working on next
&lt;/h2&gt;

&lt;p&gt;I'm exploring a WhatsApp channel for drafting and approvals, with the plan of using Meta's official API. After that I want to let clients connect their own AI assistants.&lt;/p&gt;

&lt;p&gt;If you've built a scheduling system or a multi-tenant app, I'd like to hear what you'd do differently. You can find me on &lt;a href="https://x.com/ishika1435" rel="noopener noreferrer"&gt;X&lt;/a&gt; and &lt;a href="https://github.com/Ishika1435" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>backend</category>
      <category>java</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>How I Set Up CI/CD With Automatic Rollback on a Shared VPS</title>
      <dc:creator>Ishika Thakur</dc:creator>
      <pubDate>Wed, 18 Nov 2026 18:47:57 +0000</pubDate>
      <link>https://dev.to/ishika1435/how-i-set-up-cicd-with-automatic-rollback-on-a-shared-vps-18dc</link>
      <guid>https://dev.to/ishika1435/how-i-set-up-cicd-with-automatic-rollback-on-a-shared-vps-18dc</guid>
      <description>&lt;p&gt;Until recently, releasing my project meant SSH-ing into the production server, running git pull, and then docker compose build while the live app was still running. It worked, but nothing stopped a broken build or a bad database migration from reaching users.&lt;br&gt;
So I spent a few days building a proper CI/CD pipeline for SocialPost, a social media management platform I'm building for Facebook and Instagram. Now every push to the deploy branch that passes all checks ships itself to production in about 10 minutes, with no manual step on the server.&lt;br&gt;
In this post I want to share what I built, the constraints that shaped it, and what it still can't do. I'm not an expert in DevOps, so I'll be clear about the trade-offs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8bilz6moyusgy1mwq8qw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8bilz6moyusgy1mwq8qw.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The problem: releases depended on me and luck
Before the pipeline, the setup had five problems:
• Images were built on the production server, using its CPU and memory while the live app was running.
• Tests were run by hand, if at all. Nothing blocked a red build.
• No backup was taken right before a release, so a bad migration had no clean way back.
• Rolling back meant rebuilding an old commit by hand.
• Anyone with SSH access to deploy also had a full shell on a server shared with other sites.
The goal was simple to say: production should only ever run code that passed the tests, was built once, and can be rolled back in seconds.&lt;/li&gt;
&lt;li&gt;What the pipeline does
On every push to the deploy branch, GitHub Actions:&lt;/li&gt;
&lt;li&gt; Checks the database migrations.&lt;/li&gt;
&lt;li&gt; Runs the backend tests (against PostgreSQL 16 and Redis 7) and the frontend lint, tests and build.&lt;/li&gt;
&lt;li&gt; Builds the backend and frontend Docker images once.&lt;/li&gt;
&lt;li&gt; Pushes them to GitHub Container Registry (GHCR), tagged with the full commit SHA.&lt;/li&gt;
&lt;li&gt; Asks the VPS, over SSH, to deploy that exact SHA.
Then the VPS:&lt;/li&gt;
&lt;li&gt; Takes a verified database backup.&lt;/li&gt;
&lt;li&gt; Restarts the app on the new images.&lt;/li&gt;
&lt;li&gt; Runs health checks.&lt;/li&gt;
&lt;li&gt; Rolls back automatically if any check fails.
A nightly encrypted copy of the database also goes off the server to Cloudflare R2, so the server itself can't read its own off-site backups.&lt;/li&gt;
&lt;li&gt;Decisions I'm glad I made
Build once, run that exact image. The tested image is the deployed image. Nothing is rebuilt on the server, so the server's resources stay free for the app.
Tag images with the full commit SHA, never latest. Every release is traceable, and any old release can be pulled again for a rollback.
Lock the CI key to one script. The SSH key used by CI is restricted to a single root-owned script. It can only ask for deploy , rollback or status. It has no shell. Only root can change that script, so a push to the repository can't widen what the key is allowed to do. If the key ever leaks, the damage is limited to those three actions.&lt;/li&gt;
&lt;li&gt;Constraints that shaped the design
Some of the most useful decisions came from things I couldn't do:
• A shared VPS. Other sites live on the same server, so I couldn't run a server-wide docker prune. The pipeline only cleans up SocialPost's own images, and deploys run as a dedicated user.
• One backend container runs the post scheduler. A blue-green deploy would briefly run two backends, and that could publish a post twice. So I accepted a short restart gap of about 15 to 60 seconds per deploy instead.
• Migrations run when the backend starts (Flyway). That means a rollback restores the old images, but not the database. This is why the backup before every deploy matters, and why migrations are checked in CI first.
• A private repo on GitHub's free plan. Branch rulesets can't be enforced there, so some protection depends on me following the process rather than the platform blocking me.&lt;/li&gt;
&lt;li&gt;What it still can't do
I don't want to oversell this:
• Deploys are not zero-downtime. There is a short gap while the single backend restarts.
• Rolling back does not undo database changes.
• Some safeguards rely on discipline, not enforcement, because of the free-plan limit.&lt;/li&gt;
&lt;li&gt;What I'm taking away&lt;/li&gt;
&lt;li&gt; Make the safe path the easy path. Once deploying was one push, I stopped dreading releases.&lt;/li&gt;
&lt;li&gt; Constraints are useful. The single scheduler, the shared server and the free plan each pushed me toward a clearer design.&lt;/li&gt;
&lt;li&gt; Backups only count if you can restore them. That's why the backup is verified before the deploy goes ahead.&lt;/li&gt;
&lt;li&gt; Give automation the least power it needs. A key that can only run three commands is much easier to trust.
[Add one real thing that broke or surprised you while building this, in two or three sentences.]
Conclusion
Setting this up taught me that CI/CD is less about tools and more about deciding what must be true before code reaches users. I still have things to improve, like reducing deploy downtime and enforcing the checks at the platform level.
If you've dealt with deploys on a small shared server, I'd like to hear how you handle rollbacks when the database has already changed.
SocialPost: socialpost.tech&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>githubactions</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What I Learned About Improving Database Search Performance</title>
      <dc:creator>Ishika Thakur</dc:creator>
      <pubDate>Thu, 29 Oct 2026 12:56:50 +0000</pubDate>
      <link>https://dev.to/ishika1435/what-i-learned-about-improving-database-search-performance-50gn</link>
      <guid>https://dev.to/ishika1435/what-i-learned-about-improving-database-search-performance-50gn</guid>
      <description>&lt;p&gt;When working with a large dataset, one of the things I started noticing was how much search performance matters.&lt;/p&gt;

&lt;p&gt;A search operation that seems perfectly fine with a small amount of data can become noticeably slower when the dataset grows to millions of records. During my third-year internship, I worked on a data-intensive application where search performance became an important challenge. The experience introduced me to practical database optimization and made me look beyond simply writing queries that worked.&lt;/p&gt;

&lt;p&gt;Looking back at that experience, I wanted to revisit some of the concepts involved, understand them more deeply, and share what I learned along the way.&lt;/p&gt;

&lt;p&gt;I didn't know everything about database optimization when I started working on it. However, investigating the performance issue helped me understand a few concepts that I had previously studied mostly in theory.&lt;/p&gt;

&lt;p&gt;In this post, I want to share some of those learnings without going into the application's internal implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The problem: searches becoming slow as data grows
&lt;/h2&gt;

&lt;p&gt;The application needed to support searches across a dataset containing millions of records.&lt;/p&gt;

&lt;p&gt;As the dataset grew, some searches became very slow. In certain cases, retrieving results could take around one to two minutes.&lt;/p&gt;

&lt;p&gt;This made me think about a question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If a database can store millions of records, what makes finding a particular record take so long?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer isn't always that the database is slow. The way data is stored, the indexes available, and the queries being executed can all affect performance.&lt;/p&gt;

&lt;p&gt;This was where I started looking more closely at database indexing.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Understanding database indexes
&lt;/h2&gt;

&lt;p&gt;Before working on this, I understood the basic idea of an index, but I hadn't fully appreciated its impact on a real application.&lt;/p&gt;

&lt;p&gt;Think of a book with hundreds of pages. If you want to find a particular topic, you could read every page until you find it. Alternatively, you could use the index at the back of the book to locate the relevant pages more quickly.&lt;/p&gt;

&lt;p&gt;A database index serves a similar purpose.&lt;/p&gt;

&lt;p&gt;Without a suitable index, PostgreSQL may need to examine many rows to find the records matching a search condition. This is often called a sequential scan.&lt;/p&gt;

&lt;p&gt;When an appropriate index exists, PostgreSQL may be able to locate matching records without examining every row.&lt;/p&gt;

&lt;p&gt;Of course, indexes don't automatically make every query faster. Their usefulness depends on the query, the data, and the type of index. They also require storage and can add overhead to operations that modify data.&lt;/p&gt;

&lt;p&gt;That distinction is something I want to keep in mind when thinking about database performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What changed in my project?
&lt;/h2&gt;

&lt;p&gt;I worked on improving search performance through database indexing.&lt;/p&gt;

&lt;p&gt;After the indexing-related improvements, search times went from around one to two minutes to a few seconds in the cases I was working on.&lt;/p&gt;

&lt;p&gt;That was a significant practical improvement, and it made the concepts I had learned about databases feel much more relevant.&lt;/p&gt;

&lt;p&gt;Later, I also worked with PostgreSQL GIN indexes. This introduced me to another important lesson: databases offer different index types because different kinds of queries have different needs.&lt;/p&gt;

&lt;p&gt;GIN stands for &lt;em&gt;Generalized Inverted Index&lt;/em&gt;. It can be useful when searching data structures such as arrays or JSONB values, and it can also support full-text search and certain text-search operations when configured appropriately.&lt;/p&gt;

&lt;p&gt;However, a GIN index isn't a universal replacement for other indexes. Whether it helps depends on the data, the operators used in the query, and the index configuration.&lt;/p&gt;

&lt;p&gt;I'm still building a clearer understanding of when to choose GIN, when a B-tree index is more suitable, and how to verify that an index is actually helping.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Why I want to understand more than just the fix
&lt;/h2&gt;

&lt;p&gt;One thing I've realized is that making a change and understanding why it works are two different things.&lt;/p&gt;

&lt;p&gt;For example, adding an index might improve a particular search, but I also want to understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How does PostgreSQL decide whether to use an index?&lt;/li&gt;
&lt;li&gt;How can I tell whether a query is doing a sequential scan or an index scan?&lt;/li&gt;
&lt;li&gt;How do I decide which columns or expressions should be indexed?&lt;/li&gt;
&lt;li&gt;When is a GIN index useful, and when would a B-tree index be a better choice?&lt;/li&gt;
&lt;li&gt;How can I measure an improvement rather than assume that a change helped?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These questions matter because database optimization shouldn't be about adding indexes everywhere. It should be about understanding the workload, identifying the bottleneck, and choosing an appropriate solution.&lt;/p&gt;

&lt;p&gt;Tools such as PostgreSQL's &lt;code&gt;EXPLAIN&lt;/code&gt; and &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; can help investigate query execution plans and measure query execution. I want to become more comfortable using them to explain why a query is slow and how a proposed change affects it.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. A few things I'm taking away from this experience
&lt;/h2&gt;

&lt;p&gt;My biggest takeaways so far are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Performance changes as data grows.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
A query that works well with a small dataset may behave very differently when the dataset reaches millions of records.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Indexes should be chosen based on the query.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Different index types serve different purposes. Understanding the query is an important part of choosing the right index.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Measuring matters.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
It's useful to know that a search became faster, but understanding the execution plan can help explain why it became faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. There's always more to learn.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Working on a real application gave me a reason to explore concepts beyond what I had studied in college. I'm still learning how to apply them correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Working on search performance helped me connect database concepts with a practical engineering problem.&lt;/p&gt;

&lt;p&gt;I learned more about indexing, saw how much it could matter for a large dataset, and later began exploring PostgreSQL GIN indexes.&lt;/p&gt;

&lt;p&gt;I don't consider this topic mastered yet. My next step is to understand query execution plans better and learn how to evaluate indexing choices systematically.&lt;/p&gt;

&lt;p&gt;I'd also be interested in learning how other developers approach database performance problems, particularly when an application needs to support flexible searches across large datasets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Related Project
&lt;/h3&gt;

&lt;p&gt;I’ve also documented the broader architecture and engineering decisions behind this project in a GitHub repository. It includes an architecture overview and notes on database indexing, search performance, and other backend design considerations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Ishika1435/voter-data-platform-showcase" rel="noopener noreferrer"&gt;Explore the Voter Data Platform — Engineering Overview on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The repository contains documentation only; the original production source code is not included.&lt;/p&gt;

</description>
      <category>design</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>database</category>
    </item>
  </channel>
</rss>
