mirror of
https://github.com/spartan-ng/spartan.git
synced 2026-09-22 16:41:38 +08:00
317 lines
13 KiB
Markdown
317 lines
13 KiB
Markdown
# spartan
|
|
|
|
<a href="https://spartan.ng" target="_blank">
|
|
<img alt="A spartan shield" width="200px" src="./spartan.svg" title="Spartan logo"/>
|
|
</a>
|
|
|
|
[](https://discord.gg/EqHnxQ4uQr) [](https://twitter.com/goetzrobin)
|
|
|
|
Welcome to the spartan mono-repo. This Nx repository holds both the
|
|
spartan/stack and spartan/ui libraries.
|
|
|
|
##### Important: This is a work in progress, and we update the README as major development efforts are started.
|
|
|
|
## The 300 spartans
|
|
|
|
All of spartan is an MIT-licensed open source project with its ongoing development made possible by contributors and sponsors.
|
|
|
|
Our initial 300 contributors and sponsors are featured here and on the front page of [spartan.ng](https://spartan.ng)
|
|
|
|
1. [goetzrobin](https://github.com/goetzrobin)
|
|
2. [elite-benni](https://github.com/elite-benni)
|
|
3. [thatsamsonkid](https://github.com/thatsamsonkid)
|
|
4. [ashley-hunter](https://github.com/ashley-hunter)
|
|
5. [zeropsio](https://www.github.com/zeropsio)
|
|
6. [snyder-tech](https://github.com/snyder-tech)
|
|
7. [mihajm](https://github.com/mihajm)
|
|
8. [ajitzero](https://github.com/ajitzero)
|
|
9. [arturgawlik](https://github.com/arturgawlik)
|
|
10. [deepakrudrapaul](https://github.com/deepakrudrapaul)
|
|
11. [evanfuture](https://github.com/evanfuture)
|
|
12. [AdditionAddict](https://github.com/AdditionAddict)
|
|
13. [Altamimi-Dev](https://github.com/Altamimi-Dev)
|
|
14. [ferat](https://github.com/ferat)
|
|
15. [jeremy-js-devweb](https://github.com/jeremy-js-devweb)
|
|
16. [heddendorp](https://github.com/heddendorp)
|
|
17. [tutkli](https://github.com/tutkli)
|
|
18. [Pascalmh](https://github.com/Pascalmh)
|
|
19. [okkindel](https://github.com/okkindel)
|
|
20. [marcjulian](https://github.com/marcjulian)
|
|
21. [oidre](https://github.com/oidre)
|
|
22. [nartc](https://github.com/nartc)
|
|
23. [santoshyadavdev](https://github.com/santoshyadavdev)
|
|
24. [markostanimirovic](https://github.com/markostanimirovic)
|
|
25. [theo-matzavinos](https://github.com/theo-matzavinos)
|
|
26. [jkuri](https://github.com/jkuri)
|
|
27. [dongphuong0905](https://github.com/dongphuong0905)
|
|
28. [DominikPieper](https://github.com/DominikPieper)
|
|
29. [brandonroberts](https://github.com/brandonroberts)
|
|
30. [izikd-](https://github.com/izikd-)
|
|
31. [ryancraigmartin](https://github.com/ryancraigmartin)
|
|
32. [gaetanBloch](https://github.com/gaetanBloch)
|
|
33. [gergobergo](https://github.com/gergobergo)
|
|
34. [rpacheco124](https://github.com/rpacheco124)
|
|
35. [benjaminforras](https://github.com/benjaminforras)
|
|
36. [jstnjs](https://github.com/jstnjs)
|
|
37. [r3ps4J](https://github.com/r3ps4J)
|
|
38. [Celtian](https://github.com/Celtian)
|
|
39. [miljan-code](https://github.com/miljan-code)
|
|
40. [alexciesielski](https://github.com/alexciesielski)
|
|
41. [ty-ler](https://github.com/ty-ler)
|
|
42. [m-risto](https://github.com/m-risto)
|
|
43. [badsgahhl](https://github.com/badsgahhl)
|
|
44. [monacodelisa](https://github.com/monacodelisa)
|
|
45. [tomdev9](https://github.com/tomdev9)
|
|
46. [ragul1697](https://github.com/ragul1697)
|
|
47. [kkamman](https://github.com/kkamman)
|
|
48. [i-am-the-slime](https://github.com/i-am-the-slime)
|
|
49. [DevWedeloper](https://github.com/DevWedeloper)
|
|
50. [mrsofiane](https://github.com/mrsofiane)
|
|
51. [mateoetchepare](https://github.com/mateoetchepare)
|
|
52. [DonaldMurillo](https://github.com/DonaldMurillo)
|
|
53. [toniskobic](https://github.com/toniskobic)
|
|
54. [eneajaho](https://github.com/eneajaho)
|
|
55. [Den-dp](https://github.com/Den-dp)
|
|
56. [0xfraso](https://github.com/0xfraso)
|
|
57. [Muneersahel](https://github.com/Muneersahel)
|
|
58. [danilolmc](https://github.com/danilolmc)
|
|
59. [tomalaforge](https://github.com/tomalaforge)
|
|
60. [canserkanuren](https://github.com/canserkanuren)
|
|
61. [cjosue15](https://github.com/cjosue15)
|
|
62. [hirenchauhan2](https://github.com/hirenchauhan2)
|
|
63. [Roguyt](https://github.com/Roguyt)
|
|
64. [tsironis13](https://github.com/tsironis13)
|
|
65. [0xfraso](https://github.com/0xfraso)
|
|
66. [guillermoecharri](https://github.com/guillermoecharri)
|
|
67. [ValentinFunk](https://github.com/ValentinFunk)
|
|
68. [Femi236](https://github.com/Femi236)
|
|
69. [dineshkp](https://github.com/dineshkp)
|
|
70. [robingenz](https://github.com/robingenz)
|
|
71. [Balastrong](https://github.com/Balastrong)
|
|
72. [OlegSuncrown](https://github.com/OlegSuncrown)
|
|
73. [stewones](https://github.com/stewones)
|
|
74. [shinkhouse](https://github.com/shinkhouse)
|
|
75. [donaldxdonald](https://github.com/donaldxdonald)
|
|
76. [BenoitPE](https://github.com/BenoitPE)
|
|
77. [MerlinMoos](https://github.com/MerlinMoos)
|
|
78. [miljan-code](https://www.github.com/miljan-code)
|
|
79. [Georg632](https://www.github.com/Georg632)
|
|
80. [hillin](https://www.github.com/hillin)
|
|
81. [Besbash](https://www.github.com/Besbash)
|
|
82. [davidedammino](https://www.github.com/davidedammino)
|
|
83. [marcindz88](https://www.github.com/marcindz88)
|
|
84. [thyco](https://www.github.com/thyco)
|
|
85. [hitro11](https://www.github.com/hitro11)
|
|
86. [GODrums](https://www.github.com/GODrums)
|
|
87. [samsonkumawong](https://www.github.com/samsonkumawong)
|
|
88. [PR4SAN](https://www.github.com/PR4SAN)
|
|
89. [JeevanMahesha](https://www.github.com/JeevanMahesha)
|
|
90. [dlhck](https://www.github.com/dlhck)
|
|
91. [tomer953](https://www.github.com/tomer953)
|
|
92. [drdreo](https://www.github.com/drdreo)
|
|
93. [OlegSuncrown](https://www.github.com/OlegSuncrown)
|
|
94. [tlandenberger](https://www.github.com/tlandenberger)
|
|
95. [yackinn](https://www.github.com/yackinn)
|
|
96. [OmerGronich](https://www.github.com/OmerGronich)
|
|
97. [kubalinio](https://www.github.com/kubalinio)
|
|
98. [AlexHladin](https://www.github.com/AlexHladin)
|
|
99. [CO97](https://www.github.com/CO97)
|
|
100. [MatanShushan](https://www.github.com/MatanShushan)
|
|
101. [maxhov](https://www.github.com/maxhov)
|
|
102. [josueggh](https://www.github.com/josueggh)
|
|
103. [namdien177](https://www.github.com/namdien177)
|
|
104. [zelenchuk](https://www.github.com/zelenchuk)
|
|
105. [a-malacarne](https://www.github.com/a-malacarne)
|
|
106. [YasinKuralay](https://www.github.com/YasinKuralay)
|
|
107. [nico13051995](https://www.github.com/nico13051995)
|
|
108. [francotalarico](https://www.github.com/francotalarico)
|
|
109. [koenigderluegner](https://www.github.com/koenigderluegner)
|
|
110. [Turtl3e](https://www.github.com/Turtl3e)
|
|
111. [minhnguyen120898](https://www.github.com/minhnguyen120898)
|
|
112. [liam-langstaff](https://github.com/liam-langstaff)
|
|
113. [dw-0](https://github.com/dw-0)
|
|
114. [Khumozin](https://github.com/Khumozin)
|
|
115. [abiramcodes](https://github.com/abiramcodes)
|
|
116. [garygrossgarten](https://github.com/garygrossgarten)
|
|
117. [Oussemasahbeni](https://github.com/Oussemasahbeni)
|
|
118. [benpsnyder](https://github.com/benpsnyder)
|
|
119. [dhwani1806](https://github.com/dhwani1806)
|
|
120. [elite-lucas](https://github.com/elite-lucas)
|
|
121. [esteecodes](https://github.com/esteecodes)
|
|
122. [felhag](https://github.com/felhag)
|
|
123. [notsufferbutbutter](https://github.com/notsufferbutbutter)
|
|
124. [vlrjuan](https://github.com/vlrjuan)
|
|
125. [Dafnik](https://github.com/Dafnik)
|
|
126. [hassantayyab](https://github.com/hassantayyab)
|
|
127. [mathwizard](https://github.com/mathwizard)
|
|
128. [RaminGe](https://github.com/RaminGe)
|
|
129. [abos-gergo](https://github.com/abos-gergo)
|
|
130. [jpsullivan](https://github.com/jpsullivan)
|
|
131. [ayangabryl](https://github.com/ayangabryl)
|
|
132. [s-froghyar](https://github.com/s-froghyar)
|
|
133. [aziz-zina](https://github.com/aziz-zina)
|
|
134. [avihayAsus](https://github.com/avihayAsus)
|
|
135. [multignite](https://github.com/multignite)
|
|
136. [sefatanam](https://github.com/sefatanam)
|
|
137. [LinboLen](https://github.com/LinboLen)
|
|
138. [Oneill19](https://github.com/Oneill19)
|
|
139. [homj](https://github.com/homj)
|
|
140. [Musta-Pollo](https://github.com/Musta-Pollo)
|
|
141. [mitja-kurath](https://github.com/mitja-kurath)
|
|
142. [alisterpineda](https://github.com/alisterpineda)
|
|
143. [amitshalev2](https://github.com/amitshalev2)
|
|
144. [SOG-web](https://github.com/SOG-web)
|
|
145. [Joebeurg](https://github.com/Joebeurg)
|
|
146. [mehrabix](https://github.com/mehrabix)
|
|
|
|
[Become a spartan today!](https://github.com/sponsors/goetzrobin)
|
|
|
|
## Zerops: The Strategic Alliance
|
|
|
|
<div align="center">
|
|
<a href="https://zerops.io" target="_blank">
|
|
<img src="https://avatars.githubusercontent.com/u/65757521?s=200&v=4" alt="Zerops" width="250">
|
|
</a>
|
|
</div>
|
|
|
|
spartan.ng has formed a powerful alliance with Zerops, a developer-first cloud platform that shares our commitment to advancing the Angular ecosystem.
|
|
|
|
Through their strategic support, Zerops has enabled:
|
|
|
|
- Dedicated resources for our core development team
|
|
- Accelerated component development on our path to v1
|
|
- Creation of production-ready templates and starter kits
|
|
- Long-term sustainability for the entire project
|
|
|
|
Zerops eliminates deployment complexity so developers can focus on building great software—a philosophy that perfectly aligns with our mission to create powerful yet easy-to-implement components.
|
|
|
|
**[Experience the cloud platform that's powering Spartan.ng's future →](https://zerops.io)**
|
|
|
|
## spartan/ui
|
|
|
|
spartan/ui is our effort to port the incredible shadcn/ui project over to the Angular ecosystem.
|
|
|
|
The idea is to create un-styled primitives similar to Radix with the help of the Angular CDK and other proven community solutions
|
|
And then add the beautiful shadcn styles with primitives (and components where necessary).
|
|
|
|
You can find all UI primitives in the `libs/ui` folder.
|
|
|
|
Each primitive is made up off an un-styled `brain` library, which provides all functionality and a `helm` library, which adds the styles.
|
|
|
|
There's also a `libs/cli` folder, which contains the Nx-plugin & Angular CLI code that allows users to add spartan/ui to their Nx or Angular workspace in a simple way.
|
|
|
|
The `skills/spartan` folder contains the spartan agent skill - procedural knowledge that teaches AI coding assistants how to build spartan/ui correctly. Users install it with `npx skills add spartan-ng/spartan`. See [the Skills docs](https://www.spartan.ng/documentation/skills).
|
|
|
|
### Install Dependencies
|
|
|
|
Run `pnpm install` to install the dependencies of this project.
|
|
|
|
### Development with storybook
|
|
|
|
A storybook project is set up and is the primary way to develop UI components. You can run it with:
|
|
|
|
```
|
|
pnpm run storybook
|
|
```
|
|
|
|
At the root of each primitive's folder, e.g. `libs/ui/accordion` you will find a stories file, e.g, `accordion.stories.ts`.
|
|
|
|
Use these files to add stories and drive development of the primitives.
|
|
|
|
### Testing
|
|
|
|
spartan uses [Jest](https://jestjs.io) for tests. To test all projects locally, run the following command from the root
|
|
folder:
|
|
|
|
```shell
|
|
pnpm run test
|
|
```
|
|
|
|
### e2e testing
|
|
|
|
Cypress e2e testing is set up to run on the storybook. You can run it with:
|
|
|
|
```
|
|
pnpm run e2e
|
|
```
|
|
|
|
To add your own `e2e` tests add them to the `apps/ui-storybook-e2e` application.
|
|
|
|
## spartan/stack
|
|
|
|
An example application running
|
|
on [Supabase](https://supabase.com/), [Drizzle](https://orm.drizzle.team/), [Analog](https://analogjs.org/),
|
|
[tRPC](https://trpc.io/), [Tailwind](https://tailwindcss.com/), [Angular](https://angular.io/),
|
|
and [Nx](https://nx.dev/). It also serves as the documentation page introducing the stack and UI library.
|
|
|
|
Follow the directions in the official documentation to set up your own project:
|
|
https://www.spartan.ng/stack/overview
|
|
|
|
### Example App
|
|
|
|
In the `apps` folder of this repository, you can also find an example application of the spartan stack.
|
|
It also serves as the documentation page for this project.
|
|
|
|
For now. The goal is to move the docs to Astro.
|
|
|
|
Follow the directions below to get it up and running:
|
|
|
|
#### Prerequisites
|
|
|
|
- You will need `pnpm` as your package manager.
|
|
- You will need to set up a [Supabase](https://supabase.com/) account (it's free)
|
|
- You will need [NodeJs](https://nodejs.org/en) installed. The version I have working is `20.17.0`.
|
|
|
|
#### Development server
|
|
|
|
Then you can run the following command:
|
|
|
|
```shell
|
|
pnpm nx serve app
|
|
```
|
|
|
|
or
|
|
|
|
```shell
|
|
pnpm run dev
|
|
```
|
|
|
|
for a dev server. Navigate to http://localhost:4200/. The app will automatically reload
|
|
if you change any of the source files.
|
|
|
|
#### Database
|
|
|
|
We use Drizzle to connect to a Supabase instance for the example app.
|
|
|
|
Add an `.env` file to your repo with the following contents:
|
|
|
|
Add a `.env` file at the root of your Nx workspace and add the connection string like so:
|
|
|
|
```
|
|
DATABASE_URL="postgresql://postgres:[YOUR-PASSWORD]@db.[YOUR-SUPABASE-REFERENCE-ID].supabase.co:5432/postgres?schema=public"
|
|
```
|
|
|
|
And make sure to run the following script in your Supabase editor to set up the necessary tables:
|
|
|
|
```sql
|
|
create table
|
|
public.note (
|
|
id bigserial,
|
|
title text not null,
|
|
content text null,
|
|
created_at timestamp with time zone null default current_timestamp,
|
|
constraint notes_pkey primary key (id)
|
|
) tablespace pg_default;
|
|
```
|
|
|
|
> [!NOTE] > `.env` should be added to `.gitignore`
|
|
|
|
## Understand this workspace
|
|
|
|
Run `pnpm nx graph` to see a diagram of the dependencies of the projects.
|
|
|
|
## Further help
|
|
|
|
Reach out to me on [Twitter](https://twitter.com/goetzrobin/) or [GitHub](https://github.com/goetzrobin) if you run into
|
|
any issues.
|