Skip to content

virginprogrammer/datasets-exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dataset Marketplace

A web application marketplace for buying and selling datasets with integrated payment processing (Stripe, Klarna, Nano cryptocurrency).

Project Structure

datasets-exchange/
├── backend/                 # ASP.NET Core Web API
│   ├── src/
│   │   ├── DatasetMarketplace.API/          # API Layer
│   │   ├── DatasetMarketplace.Application/  # Application Layer (Services, DTOs)
│   │   ├── DatasetMarketplace.Domain/       # Domain Layer (Entities, Enums)
│   │   └── DatasetMarketplace.Infrastructure/ # Infrastructure Layer (Database, Repositories)
│   └── tests/
│       ├── DatasetMarketplace.UnitTests/
│       └── DatasetMarketplace.IntegrationTests/
├── frontend/                # Angular 17+ Application
│   └── src/
│       └── app/
│           ├── core/        # Core services, guards, interceptors
│           ├── shared/      # Shared components
│           └── features/    # Feature modules
└── PROJECT_PLAN.md          # Comprehensive project plan

Technology Stack

Backend

  • Framework: ASP.NET Core 8.0
  • Language: C# (.NET 8)
  • Database: PostgreSQL 15+
  • ORM: Entity Framework Core 8.0
  • Authentication: JWT (JSON Web Tokens)
  • API Documentation: Swagger/OpenAPI

Frontend

  • Framework: Angular 17+
  • Language: TypeScript 5+
  • HTTP Client: Angular HttpClient with interceptors
  • Forms: Reactive Forms
  • Styling: SCSS

Phase 1 Implementation Status

Completed Features:

Backend

  • Clean Architecture project structure
  • Domain entities (User, Dataset, Transaction, Category, Reviews, etc.)
  • Entity Framework Core configuration
  • PostgreSQL database configuration
  • Repository pattern with Unit of Work
  • JWT authentication service
  • Auth controller (Register, Login, Password Reset)
  • Swagger documentation setup
  • CORS configuration for Angular

Frontend

  • Angular 17 project with standalone components
  • Core services (AuthService, ApiService)
  • HTTP interceptors (Auth, Error)
  • Route guards (AuthGuard)
  • Login component
  • Register component
  • Marketplace component (placeholder)
  • Lazy-loaded feature modules
  • Environment configuration

Prerequisites

  • .NET 8 SDK - Download
  • Node.js 18+ and npm - Download
  • PostgreSQL 15+ - Download
  • Angular CLI - npm install -g @angular/cli

Setup Instructions

1. Database Setup

Create a PostgreSQL database:

CREATE DATABASE dataset_marketplace;

2. Backend Setup

Navigate to the backend API project:

cd backend/src/DatasetMarketplace.API

Update the connection string in appsettings.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "Host=localhost;Port=5432;Database=dataset_marketplace;Username=your_username;Password=your_password"
  }
}

Run database migrations:

dotnet ef migrations add InitialCreate --project ../DatasetMarketplace.Infrastructure
dotnet ef database update

Run the API:

dotnet run

The API will be available at:

  • HTTP: http://localhost:5000
  • HTTPS: https://localhost:5001
  • Swagger UI: http://localhost:5000/swagger

3. Frontend Setup

Navigate to the frontend directory:

cd frontend

Install dependencies:

npm install

Update the API URL in src/environments/environment.ts if needed:

export const environment = {
  production: false,
  apiUrl: 'http://localhost:5000'
};

Run the Angular development server:

ng serve

The app will be available at http://localhost:4200

API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/register Register a new user
POST /api/auth/login Login with email/password
POST /api/auth/refresh Refresh access token
GET /api/auth/verify-email Verify email address
POST /api/auth/forgot-password Request password reset
POST /api/auth/reset-password Reset password

Example Register Request

{
  "email": "[email protected]",
  "password": "SecurePassword123",
  "firstName": "John",
  "lastName": "Doe",
  "userType": 1
}

UserType values:

  • 1 = Buyer
  • 2 = Seller
  • 3 = Both

Testing the Application

Using Swagger UI

  1. Navigate to http://localhost:5000/swagger
  2. Try the /api/auth/register endpoint to create a user
  3. Try the /api/auth/login endpoint to get a JWT token
  4. Click "Authorize" and enter: Bearer <your-token>
  5. Test protected endpoints

Using the Angular Frontend

  1. Navigate to http://localhost:4200
  2. Click "Login" or navigate to /auth/register
  3. Create an account
  4. Login with your credentials
  5. You'll be redirected to the marketplace

Database Schema

Core Tables

  • Users - User accounts (buyers/sellers)
  • Datasets - Dataset listings
  • Categories - Dataset categories
  • Transactions - Purchase transactions
  • DatasetReviews - User reviews and ratings
  • DatasetPurchases - Purchase records
  • DatasetFiles - Dataset file metadata
  • DatasetMetadata - Dataset statistics and schema

Next Steps (Phase 2)

  • Dataset upload functionality
  • Dataset browsing and search
  • Dataset preview generation
  • File storage service (S3/Azure Blob)
  • Seller dashboard
  • Buyer dashboard

Next Steps (Phase 3)

  • Stripe payment integration
  • Klarna payment integration
  • Nano cryptocurrency payment integration
  • Transaction management
  • Payout system

Development Notes

JWT Configuration

The JWT secret key is configured in appsettings.json. Change this in production!

{
  "JwtSettings": {
    "SecretKey": "YourSuperSecretKeyThatIsAtLeast32CharactersLongForHS256Algorithm",
    "Issuer": "DatasetMarketplace",
    "Audience": "DatasetMarketplaceUsers",
    "ExpiryMinutes": "60"
  }
}

CORS Configuration

The backend is configured to accept requests from http://localhost:4200. Update this in production:

// Program.cs
builder.Services.AddCors(options =>
{
    options.AddPolicy("AllowAngularApp", policy =>
    {
        policy.WithOrigins("https://your-production-domain.com")
              .AllowAnyHeader()
              .AllowAnyMethod()
              .AllowCredentials();
    });
});

Troubleshooting

Database Connection Issues

If you encounter database connection errors:

  1. Ensure PostgreSQL is running
  2. Verify the connection string in appsettings.json
  3. Check that the database exists

CORS Errors

If you see CORS errors in the browser console:

  1. Ensure the backend is running
  2. Verify the CORS policy in Program.cs
  3. Check that the Angular app is running on port 4200

JWT Token Errors

If authentication fails:

  1. Check that the JWT secret key is configured
  2. Verify the token is being sent in the Authorization header
  3. Check token expiration

Contributing

Please refer to the PROJECT_PLAN.md for the complete development roadmap and implementation details.

License

[Add your license information here]

About

A place to buy and sell datasets for AI training

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •