<?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: Diksha Sahota</title>
    <description>The latest articles on DEV Community by Diksha Sahota (@dikshasahota28).</description>
    <link>https://dev.to/dikshasahota28</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%2F4268671%2F261a4bc1-d028-4997-ba5b-9524e28793ae.png</url>
      <title>DEV Community: Diksha Sahota</title>
      <link>https://dev.to/dikshasahota28</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dikshasahota28"/>
    <language>en</language>
    <item>
      <title>Fuel Station API: Secure JWT Login and Credit Customer Management</title>
      <dc:creator>Diksha Sahota</dc:creator>
      <pubDate>Fri, 27 Nov 2026 10:15:06 +0000</pubDate>
      <link>https://dev.to/dikshasahota28/fuel-station-api-secure-jwt-login-and-credit-customer-management-410i</link>
      <guid>https://dev.to/dikshasahota28/fuel-station-api-secure-jwt-login-and-credit-customer-management-410i</guid>
      <description>&lt;h1&gt;
  
  
  How a REST Backend with SQL Server and Swagger Controls Staff Access and Organizes Credit Customer Records
&lt;/h1&gt;

&lt;p&gt;Before a fuel station hands out fuel on credit, it needs answers to two important questions:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Who is allowed to access the system?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Which customers are approved for credit?&lt;/strong&gt;&lt;br&gt;
The &lt;strong&gt;Fuel Station API&lt;/strong&gt; is a backend project built to address both requirements. It manages staff authentication using JWT and organizes credit customer records through a clean set of REST APIs.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore what the Fuel Station API does, how its layered architecture works, what a cashier's daily workflow looks like, and the 10 key features that make it a solid foundation for a fuel station management system.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is the Fuel Station API?
&lt;/h2&gt;

&lt;p&gt;The Fuel Station API is a &lt;strong&gt;backend-only application&lt;/strong&gt;. It currently has no frontend interface, and every endpoint can be tested directly through &lt;strong&gt;Swagger&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Since it follows REST conventions, web and mobile applications can connect to the same backend in the future without changing its core business logic.&lt;/p&gt;

&lt;p&gt;The project is built around two main modules:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Login API:&lt;/strong&gt; Handles staff authentication and access control.&lt;br&gt;
&lt;strong&gt;Party API:&lt;/strong&gt; Manages credit customer records.&lt;/p&gt;

&lt;h2&gt;
  
  
  Core Modules of the Fuel Station API
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Login API: Secure JWT Authentication for Staff
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Ensure that only authenticated staff members can access party management operations.&lt;/p&gt;

&lt;p&gt;Here's how the login process works:&lt;/p&gt;

&lt;p&gt;The user sends their username and password to the login endpoint.&lt;br&gt;
The server hashes the submitted password using the configured hashing mechanism and compares it with the stored hash.&lt;br&gt;
If the credentials match, the API generates a JWT (JSON Web Token) containing the user's ID and username.&lt;br&gt;
The generated token remains valid for &lt;strong&gt;8 hours&lt;/strong&gt;.&lt;br&gt;
If the username or password is incorrect, the API returns a login failure response.&lt;br&gt;
Once authenticated, staff members can use the returned token to access protected endpoints.&lt;br&gt;
You Can also checkout my github-project-link:-&lt;br&gt;
&lt;a href="https://github.com/diksha-124/fuelstationAPI" rel="noopener noreferrer"&gt;https://github.com/diksha-124/fuelstationAPI&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Party API: Credit Customer Management (CRUD)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Maintain accurate records of individuals and businesses that receive fuel on credit.&lt;/p&gt;

&lt;p&gt;In this system, a &lt;strong&gt;party&lt;/strong&gt; represents a credit customer. Examples include transporters, contractors, and vehicle fleet operators.&lt;/p&gt;

&lt;p&gt;Each party record contains the following information:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Name&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Mobile Number&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;City&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Credit Limit&lt;/strong&gt;&lt;br&gt;
The Party API supports five operations:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Get Parties&lt;/td&gt;
&lt;td&gt;Retrieves all registered parties.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Get Party by ID&lt;/td&gt;
&lt;td&gt;Retrieves a specific party using its ID.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Add Party&lt;/td&gt;
&lt;td&gt;Registers a new credit customer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Update Party&lt;/td&gt;
&lt;td&gt;Updates an existing party's information.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete Party&lt;/td&gt;
&lt;td&gt;Removes a party record.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; All Party API endpoints require a valid authentication token.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the Fuel Station API Works: Layered Architecture
&lt;/h2&gt;

&lt;p&gt;The application follows a layered architecture in which each layer has a specific responsibility.&lt;/p&gt;

&lt;p&gt;This separation makes the backend easier to maintain, test, and extend.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Controller&lt;/td&gt;
&lt;td&gt;Receives HTTP requests and returns appropriate responses.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Service&lt;/td&gt;
&lt;td&gt;Handles business logic and validates data, such as party names and IDs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Repository&lt;/td&gt;
&lt;td&gt;Communicates with the SQL Server database through stored procedures.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database&lt;/td&gt;
&lt;td&gt;Stores user and party information.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  How Database Operations Are Handled
&lt;/h3&gt;

&lt;p&gt;Every database operation has its own stored procedure.&lt;/p&gt;

&lt;p&gt;Values such as customer names, mobile numbers, and credit limits are passed as parameters instead of being directly concatenated into SQL queries.&lt;/p&gt;

&lt;p&gt;This approach helps protect the application against &lt;strong&gt;SQL injection attacks&lt;/strong&gt; and keeps database operations organized.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP Status Codes Returned by the API
&lt;/h3&gt;

&lt;p&gt;The API uses standard HTTP status codes to communicate the result of each request.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Status Code&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;200 OK&lt;/td&gt;
&lt;td&gt;The request completed successfully.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;400 Bad Request&lt;/td&gt;
&lt;td&gt;The input is invalid or a validation error occurred.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;401 Unauthorized&lt;/td&gt;
&lt;td&gt;Authentication is missing, invalid, or expired.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;404 Not Found&lt;/td&gt;
&lt;td&gt;The requested party record does not exist.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Real-World Example: A Cashier's Workflow at a Fuel Station
&lt;/h2&gt;

&lt;p&gt;Let's understand how the API fits into a cashier's normal working day.&lt;/p&gt;

&lt;p&gt;The cashier opens the application and logs in using their username and password.&lt;br&gt;
The system verifies the credentials and issues an authentication token.&lt;br&gt;
A transporter arrives and requests fuel on credit.&lt;br&gt;
The cashier searches for the transporter's existing party record.&lt;br&gt;
The system displays the registered name, mobile number, city, and approved credit limit.&lt;br&gt;
If the customer is new, the cashier can register them as a new party.&lt;br&gt;
Existing party information can be updated or deleted when required.&lt;br&gt;
After 8 hours, the authentication token expires, and the cashier must log in again.&lt;br&gt;
All these API operations can currently be tested through Swagger without requiring a separate frontend application.&lt;/p&gt;

&lt;h2&gt;
  
  
  10 Key Features and Benefits of the Fuel Station API
&lt;/h2&gt;

&lt;p&gt;Here are the 10 important features that make this backend useful for fuel station management.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Protected Party Management
&lt;/h3&gt;

&lt;p&gt;Every party management endpoint requires a valid authentication token. This ensures that customer records are accessible only to authenticated users.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Automatic Token Expiration
&lt;/h3&gt;

&lt;p&gt;JWT tokens expire after 8 hours. This prevents a session from remaining active indefinitely.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Password Hashing
&lt;/h3&gt;

&lt;p&gt;Passwords are processed using a configured hashing mechanism instead of being stored or returned as plain text.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Full JWT Validation
&lt;/h3&gt;

&lt;p&gt;The API validates the token's signature, issuer, audience, and expiration time before allowing access to protected resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Centralized Customer Records
&lt;/h3&gt;

&lt;p&gt;Every credit customer has a structured record containing their name, mobile number, city, and credit limit.&lt;/p&gt;

&lt;p&gt;This makes customer information easier to retrieve and manage.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Credit Limit Visibility
&lt;/h3&gt;

&lt;p&gt;The approved credit limit is included in each party record, allowing staff to check the customer's registered credit limit before providing fuel on credit.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Complete CRUD Operations
&lt;/h3&gt;

&lt;p&gt;The Party API supports all essential record management operations:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create:&lt;/strong&gt; Add a new party.&lt;br&gt;
&lt;strong&gt;Read:&lt;/strong&gt; Retrieve existing party records.&lt;br&gt;
&lt;strong&gt;Update:&lt;/strong&gt; Modify party information.&lt;br&gt;
&lt;strong&gt;Delete:&lt;/strong&gt; Remove a party record.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Built-In Input Validation
&lt;/h3&gt;

&lt;p&gt;The API applies validation rules to maintain consistent data.&lt;/p&gt;

&lt;p&gt;Some examples include:&lt;/p&gt;

&lt;p&gt;Party names cannot be empty or exceed 100 characters.&lt;br&gt;
Party IDs must be greater than zero.&lt;br&gt;
Mobile numbers cannot exceed 15 characters.&lt;br&gt;
City names cannot exceed 50 characters.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. SQL Server Stored Procedures
&lt;/h3&gt;

&lt;p&gt;All database operations are handled through SQL Server stored procedures.&lt;/p&gt;

&lt;p&gt;Input values are passed as parameters rather than being directly combined with SQL query strings.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Ready for Frontend Integration
&lt;/h3&gt;

&lt;p&gt;Swagger documents the API endpoints, parameters, response codes, and authentication requirements.&lt;/p&gt;

&lt;p&gt;This makes it easier for frontend developers to connect a web or mobile application to the backend.&lt;/p&gt;

&lt;p&gt;The same architecture can also be extended to support additional modules in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions (FAQs)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. What does "party" mean in the Fuel Station API?
&lt;/h3&gt;

&lt;p&gt;A party represents a credit customer — an individual or business that receives fuel on credit. Examples include transporters, contractors, and vehicle fleet operators.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. How long does a login token remain valid?
&lt;/h3&gt;

&lt;p&gt;Each JWT authentication token remains valid for &lt;strong&gt;8 hours&lt;/strong&gt;. After expiration, the user must log in again to receive a new token.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Can I test the API without a frontend?
&lt;/h3&gt;

&lt;p&gt;Yes. Every endpoint is documented and can be tested directly through Swagger.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. How does the API protect against SQL injection?
&lt;/h3&gt;

&lt;p&gt;Input values are passed to SQL Server stored procedures as parameters instead of being concatenated directly into SQL queries. This is a standard defence against SQL injection.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Which database does the API use?
&lt;/h3&gt;

&lt;p&gt;The Fuel Station API uses &lt;strong&gt;Microsoft SQL Server&lt;/strong&gt;, with individual stored procedures for database operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Can additional modules be added later?
&lt;/h3&gt;

&lt;p&gt;Yes. The layered architecture makes it possible to extend the application with additional modules, such as:&lt;/p&gt;

&lt;p&gt;Shift Management&lt;br&gt;
Fuel Sales Management&lt;br&gt;
Receipt Generation&lt;br&gt;
Customer Transaction History&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: A Solid Backend Foundation for Fuel Station Management
&lt;/h2&gt;

&lt;p&gt;The Fuel Station API provides a structured backend foundation for two essential fuel station operations: &lt;strong&gt;controlling staff access and managing credit customer records&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By combining JWT authentication, REST APIs, SQL Server stored procedures, Swagger documentation, and a layered architecture, the project demonstrates how backend development can solve practical business requirements.&lt;/p&gt;

&lt;p&gt;The API can already be tested through Swagger, and its modular structure provides room for future expansion as the fuel station management system grows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Additional modules such as shift management, fuel sales, and receipt generation can build on this foundation to create a more complete fuel station management solution.&lt;/p&gt;

&lt;p&gt;If you found this useful, drop a  or leave a comment. I'd love to hear how you'd extend this API!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>aspnet</category>
      <category>webdev</category>
      <category>webapi</category>
    </item>
  </channel>
</rss>
