Code Monkey home page Code Monkey logo

sorisso-store's Introduction



Sorisso Online Store

A modern online store built with Next.js, TypeScript, Tailwind CSS, and Clerk for authentication.

Key FeaturesHow To UseDownloadCreditsRelatedLicense

Key Features

  • User authentication with Clerk
  • Styled with Tailwind CSS
  • Built with TypeScript
  • Fetch and display products from an API
  • Optimized image loading with next/image
  • Responsive design
  • Error handling for data fetching

How To Use

To clone and run this application, you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:

# Clone this repository
$ git clone https://github.com/amuari/sorisso-store

# Go into the repository
$ cd my-app

# Install dependencies
$ npm install

# Run the app
$ npm run dev

Configuration

Ensure that you configure the external image domains in your next.config.js file:

// next.config.js
module.exports = {
  images: {
    domains: ['fakestoreapi.com'],
  },
};

Set up Clerk authentication by adding your Clerk frontend API key to the environment variables:

# .env.local
NEXT_PUBLIC_CLERK_FRONTEND_API=your-clerk-frontend-api

Example Code

Here is an example of how to fetch and display products:

// app/page.tsx
import Image from 'next/image';
import { Product } from '../types/Product';

async function getData(): Promise<Product[]> {
  const res = await fetch('https://fakestoreapi.com/products');

  if (!res.ok) {
    throw new Error('Failed to fetch data');
  }

  return res.json();
}

const Page = async () => {
  const data = await getData();

  return (
    <div className="p-4">
      {data.map((product) => (
        <div key={product.id} className="border p-4 m-2 rounded-lg shadow-lg">
          <h2 className="text-xl font-bold">{product.title}</h2>
          <p>{product.description}</p>
          <p className="text-lg font-semibold">${product.price}</p>
          <Image
            src={product.image}
            alt={product.title}
            width={200}
            height={200}
            layout="responsive"
            className="rounded"
          />
        </div>
      ))}
    </div>
  );
};

export default Page;

Download

You can download the latest version of the Online Store for Windows, macOS, and Linux.

Credits

This software uses the following open source packages:

License

MIT


GitHub @amuari  ·  Twitter (https://twitter.com/amuaridev)


sorisso-store's People

Contributors

amuari avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.