Skip to main content

Prerequisites

Before you begin, ensure you have the following installed:
  • .NET 10.0 SDK
  • SQLite
  • Entity Framework Core tools (for migrations)

Setup Workflow

1

Clone repository and install dependencies

Clone the repository and restore NuGet packages:
git clone <repository-url>
cd Social-Media-Activity-Feed
dotnet restore
The project includes these key dependencies:
  • Microsoft.EntityFrameworkCore.Sqlite
  • Microsoft.AspNetCore.Authentication.JwtBearer
  • Microsoft.EntityFrameworkCore.Tools
2

Configure JWT settings

Set up JWT authentication using .NET user secrets:
dotnet user-secrets set "Jwt:Issuer" "your-issuer-name"
dotnet user-secrets set "Jwt:Key" "your-secure-secret-key-here"
The JWT key should be a strong, random string. Keep it secure and never commit it to version control.
3

Run EF Core migrations

Initialize the database with Entity Framework Core migrations:
dotnet ef database update
This creates the SQLite database (social.db) with all required tables.
4

Start the API

Run the application:
dotnet run
The API will start on the default port (typically http://localhost:5000 or https://localhost:5001).
5

Register a user

Create your first user account:
curl -X POST http://localhost:5000/api/register \
  -H "Content-Type: application/json" \
  -d '{
    "userName": "johndoe",
    "firstName": "John",
    "lastName": "Doe",
    "passwordHash": "SecurePassword123!",
    "email": "[email protected]",
    "phoneNumber": "+1234567890"
  }'
Response:
201 Created
6

Login and get JWT token

Authenticate to receive an access token:
curl -X POST http://localhost:5000/api/login \
  -H "Content-Type: application/json" \
  -d '{
    "Username": "johndoe",
    "ProvidedPassword": "SecurePassword123!"
  }'
Response:
{
  "loginResult": {
    "userID": 1,
    "userName": "johndoe",
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "phoneNumber": "+1234567890",
    "profileImage_MediaUrl": ""
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Save the accessToken for authenticated requests.
7

Make authenticated request

Use the JWT token to make authenticated requests. For example, follow another user:
curl -X POST http://localhost:5000/api/users/janedoe/follow \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -d '{
    "userName": "johndoe"
  }'
Response:
204 No Content
This creates a follow relationship and triggers a notification for the followed user.
The API uses SQLite for local development, which stores data in a single file (social.db). This makes it easy to get started without setting up a separate database server.

Next Steps

Build docs developers (and LLMs) love