Follow @ServiceStack or join the Google+ Community for updates, or StackOverflow or the Customer Forums for support.
View the Release Notes for latest features or see servicestack.net/features for an overview.
ServiceStack is a simple, fast, versatile and highly-productive full-featured Web and Web Services Framework that's thoughtfully-architected to reduce artificial complexity and promote remote services best-practices with a message-based design that allows for maximum re-use that can leverage an integrated Service Gateway for the creation of loosely-coupled Modularized Service Architectures. ServiceStack Services are consumable via an array of built-in fast data formats (inc. JSON, XML, CSV, JSV, ProtoBuf, Wire and MsgPack) as well as XSD/WSDL for SOAP endpoints and Rabbit MQ, Redis MQ and Amazon SQS MQ hosts.
Its design and simplicity focus offers an unparalleled suite of productivity features that can be declaratively enabled without code, from creating fully queryable Web API's with just a single Typed Request DTO with Auto Query supporting every major RDBMS to the built-in support for Auto Batched Requests or effortlessly enabling rich HTTP Caching and Encrypted Messaging for all your existing services via Plugins.
Your same Services also serve as the Controller in ServiceStack's Smart Razor Views reducing the effort to serve both Web and Single Page Apps as well as Rich Desktop and Mobile Clients that are able to deliver instant interactive experiences using ServiceStack's real-time Server Events.
ServiceStack Services also maximize productivity for consumers providing an instant end-to-end typed API without code-gen enabling the most productive development experience for developing .NET to .NET Web Services.
ServiceStack now integrates with all Major IDE's used for creating the best native experiences on the most popular platforms to enable a highly productive dev workflow for consuming Web Services, making ServiceStack the ideal back-end choice for powering rich, native iPhone and iPad Apps on iOS with Swift, Mobile and Tablet Apps on the Android platform with Java, OSX Desktop Appications as well as targetting the most popular .NET PCL platforms including Xamarin.iOS, Xamarin.Android, Windows Store, WPF, WinForms and Silverlight:
Providing instant Native Typed API's for C#, TypeScript, F# and VB.NET directly in Visual Studio for the most popular .NET platforms including iOS and Android using Xamarin.iOS and Xamarin.Android on Windows.
Providing C# Native Types support for developing iOS and Android mobile Apps using Xamarin.iOS and Xamarin.Android with Xamarin Studio on OSX. The ServiceStackXS plugin also provides a rich web service development experience developing Client applications with Mono Develop on Linux
Providing an instant Native Typed API in Swift including generic Service Clients enabling a highly-productive workflow and effortless consumption of Web Services from native iOS and OSX Applications - directly from within Xcode!
Providing an instant Native Typed API in Java and Kotlin including idiomatic Java Generic Service Clients supporting Sync and Async Requests by levaraging Android's AsyncTasks to enable the creation of services-rich and responsive native Java or Kotlin Mobile Apps on the Android platform - directly from within Android Studio!
The ServiceStack IDEA plugin is installable directly from IntelliJ's Plugin repository and enables seamless integration with IntelliJ Java Maven projects for genearting a Typed API to quickly and effortlessly consume remote ServiceStack Web Services from pure cross-platform Java or Kotlin Clients.
The unmatched productivity offered by Java Add ServiceStack Reference is also available in the ServiceStackEclipse IDE Plugin that's installable from the Eclipse MarketPlace to provide deep integration of Add ServiceStack Reference with Eclipse Java Maven Projects enabling Java Developers to effortlessly Add and Update the references of their evolving remote ServiceStack Web Services.
In addition to our growing list of supported IDE's, the servicestack-cli cross-platform command-line npm scripts makes it easy for build servers, automated tasks and command-line runners of your favorite text editors to easily Add and Update ServiceStack References!
This example is also available as a stand-alone integration test:
//Web Service Host Configuration
public class AppHost : AppSelfHostBase
{
public AppHost()
: base("Customer REST Example", typeof(CustomerService).Assembly) {}
public override void Configure(Container container)
{
//Register which RDBMS provider to use
container.Register<IDbConnectionFactory>(c =>
new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider));
using (var db = container.Resolve<IDbConnectionFactory>().Open())
{
//Create the Customer POCO table if it doesn't already exist
db.CreateTableIfNotExists<Customer>();
}
}
}
//Web Service DTO's
[Route("/customers", "GET")]
public class GetCustomers : IReturn<GetCustomersResponse> {}
public class GetCustomersResponse
{
public List<Customer> Results { get; set; }
}
[Route("/customers/{Id}", "GET")]
public class GetCustomer : IReturn<Customer>
{
public int Id { get; set; }
}
[Route("/customers", "POST")]
public class CreateCustomer : IReturn<Customer>
{
public string Name { get; set; }
}
[Route("/customers/{Id}", "PUT")]
public class UpdateCustomer : IReturn<Customer>
{
public int Id { get; set; }
public string Name { get; set; }
}
[Route("/customers/{Id}", "DELETE")]
public class DeleteCustomer : IReturnVoid
{
public int Id { get; set; }
}
// POCO DB Model
public class Customer
{
[AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
}
//Web Services Implementation
public class CustomerService : Service
{
public object Get(GetCustomers request)
{
return new GetCustomersResponse { Results = Db.Select<Customer>() };
}
public object Get(GetCustomer request)
{
return Db.SingleById<Customer>(request.Id);
}
public object Post(CreateCustomer request)
{
var customer = new Customer { Name = request.Name };
Db.Save(customer);
return customer;
}
public object Put(UpdateCustomer request)
{
var customer = Db.SingleById<Customer>(request.Id);
if (customer == null)
throw HttpError.NotFound("Customer '{0}' does not exist".Fmt(request.Id));
customer.Name = request.Name;
Db.Update(customer);
return customer;
}
public void Delete(DeleteCustomer request)
{
Db.DeleteById<Customer>(request.Id);
}
}
No code-gen required, can re-use above Server DTOs:
var client = new JsonServiceClient(BaseUri);
//GET /customers
var all = client.Get(new GetCustomers()); // Count = 0
//POST /customers
var customer = client.Post(new CreateCustomer { Name = "Foo" });
//GET /customer/1
customer = client.Get(new GetCustomer { Id = customer.Id }); // Name = Foo
//GET /customers
all = client.Get(new GetCustomers()); // Count = 1
//PUT /customers/1
customer = client.Put(
new UpdateCustomer { Id = customer.Id, Name = "Bar" }); // Name = Bar
//DELETE /customers/1
client.Delete(new DeleteCustomer { Id = customer.Id });
//GET /customers
all = client.Get(new GetCustomers()); // Count = 0
Same code also works with Android, iOS, Xamarin.Forms, UWP and WPF clients.
F# and VB.NET can re-use same .NET Service Clients and DTO's
const client = new JsonServiceClient(baseUrl);
const { results } = await client.get(new GetCustomers());
let client = JsonServiceClient(baseUrl: BaseUri)
client.getAsync(GetCustomers())
.then {
let results = $0.results;
}
JsonServiceClient client = new JsonServiceClient(BaseUri);
GetCustomersResponse response = client.get(new GetCustomers());
List<Customer> results = response.results;
val client = JsonServiceClient(BaseUri)
val response = client.get(GetCustomers())
val results = response.results
var client = new JsonServiceClient(BaseUri);
var response = await client.get(GetCustomers());
var results = client.results;
$.getJSON($.ss.createUrl("/customers", request), request, (r: GetCustomersResponse) => {
var results = r.results;
});
Using TypeScript Definitions with Angular HTTP Client:
this.http.get<GetCustomersResponse>(createUrl('/customers', request)).subscribe(r => {
this.results = r.results;
});
$.getJSON(baseUri + "/customers", function(r) {
var results = r.results;
});
That's all the application code required to create and consume a simple database-enabled REST Web Service!
If you have NuGet installed, the easiest way to get started is to:
Latest v4+ on NuGet is a commercial release with free quotas.
The Definitive list of Example Projects, Use-Cases, Demos, Starter Templates
Since September 2013, ServiceStack source code is available under GNU Affero General Public License/FOSS License Exception, see license.txt in the source. Alternative commercial licensing is also available, see https://servicestack.net/pricing for details.
Contributors need to approve the Contributor License Agreement before any code will be reviewed, see the Contributing docs for more details. All contributions must include tests verifying the desired behavior.
ServiceStack includes source code of the great libraries below for some of its core functionality. Each library is released under its respective licence:
- Mono (MIT License)
- Funq IOC (MS-PL License)
- Fluent Validation (Apache License 2.0)
- Mini Profiler (MIT License)
- Dapper (Apache License 2.0)
- TweetStation's OAuth library (MIT License)
- MarkdownSharp (MIT License)
- MarkdownDeep (Apache License 2.0)
- HtmlCompressor (Apache License 2.0)
- JSMin (Apache License 2.0)
- RecyclableMemoryStream (MIT License)
- ASP.NET MVC (Apache License 2.0)
- CoreFX (MIT License)
Follow @ServiceStack and +ServiceStack for project updates.
- mythz (Demis Bellot)
- layoric (Darren Reid) / @layoric
- xplicit (Sergey Zhukov) / @quantumcalc
- desunit (Sergey Bogdanov) / @desunit
- arxisos (Steffen Müller) / @arxisos
A big thanks to GitHub and all of ServiceStack's contributors:
- bman654 (Brandon Wallace)
- iristyle (Ethan Brown)
- superlogical (Jake Scott)
- itamar82
- chadwackerman
- derfsplat
- johnacarruthers (John Carruthers)
- mvitorino (Miguel Vitorino)
- bsiegel (Brandon Siegel)
- mdavid (M. David Peterson)
- lhaussknecht (Louis Haussknecht)
- grendello (Marek Habersack)
- SteveDunn (Steve Dunn)
- kcherenkov (Konstantin Cherenkov)
- timryan (Tim Ryan)
- letssellsomebananas (Tymek Majewski)
- danbarua (Dan Barua)
- JonCanning (Jon Canning)
- paegun (James Gorlick)
- pvasek (pvasek)
- derfsplat (derfsplat)
- justinrolston (Justin Rolston)
- danmiser (Dan Miser)
- danatkinson (Dan Atkinson)
- brainless83 (Thomas Grassauer)
- angelcolmenares (angel colmenares)
- dbeattie71 (Derek Beattie)
- danielwertheim (Daniel Wertheim)
- greghroberts (Gregh Roberts)
- int03 (Selim Selçuk)
- andidog (AndiDog)
- chuckb (chuckb)
- niemyjski (Blake Niemyjski)
- mj1856 (Matt Johnson)
- matthieugd (Matthieu)
- tomaszkubacki (Tomasz Kubacki)
- e11137 (Rogelio Canedo)
- davidroth (David Roth)
- meebey (Mirco Bauer)
- codedemonuk (Pervez Choudhury)
- jrosskopf (Joachim Rosskopf)
- friism (Michael Friis)
- mp3125
- aurimas86
- parnham (Dan Parnham)
- yeurch (Richard Fawcett)
- damianh (Damian Hickey)
- freeman (Michel Rasschaert)
- kvervo (Kvervo)
- pauldbau (Paul Du Bois)
- justinpihony (Justin Pihony)
- bokmadsen (Bo Kingo Damgaard)
- dragan (Dale Ragan)
- sneal (Shawn Neal)
- johnsheehan (John Sheehan)
- jschlicht (Jared Schlicht)
- kumarnitin (Nitin Kumar)
- davidchristiansen (David Christiansen)
- paulecoyote (Paul Evans)
- kongo2002 (Gregor Uhlenheuer)
- brannonking (Brannon King)
- alexandrerocco (Alexandre Rocco)
- cbarbara
- assaframan (Assaf Raman)
- csakshaug (Christian Sakshaug)
- johnman
- jarroda
- ssboisen (Simon Skov Boisen)
- paulduran (Paul Duran)
- pruiz (Pablo Ruiz García)
- fantasticjamieburns
- pseabury
- kevingessner (Kevin Gessner)
- iskomorokh (Igor Skomorokh)
- royjacobs (Roy Jacobs)
- robertmircea (Robert Mircea)
- markswiatek (Mark Swiatek)
- flq (Frank Quednau)
- ashd (Ash D)
- thanhhh
- algra (Alexey Gravanov)
- jimschubert (Jim Schubert)
- gkathire
- mikaelwaltersson (Mikael Waltersson)
- asunar (Alper)
- chucksavage (Chuck Savage)
- sashagit (Sasha)
- froyke (Froyke)
- dbhobbs (Daniel Hobbs)
- bculberson (Brad Culberson)
- awr (Andrew)
- pingvinen (Patrick)
- citndev (Sebastien Curutchet)
- cyberprune
- jorbor (Jordan Hayashi)
- bojanv55
- i-e-b (Iain Ballard)
- pietervp (Pieter Van Parys)
- franklinwise
- ckasabula (Chuck Kasabula)
- dortzur (Dor Tzur)
- allenarthurgay (Allen Gay)
- viceberg
- vansha (Ivan Korneliuk)
- aaronlerch (Aaron Lerch)
- glikoz
- danielcrenna (Daniel Crenna)
- stevegraygh (Steve Graygh)
- jrmitch120 (Jeff Mitchell)
- manuelnelson (Manuel Nelson)
- babcca (Petr Babicka)
- jgeurts (Jim Geurts)
- driis (Dennis Riis)
- gshackles (Greg Shackles)
- jsonmez (John Sonmez)
- dchurchland (David Churchland)
- softwx (Steve Hatchett)
- ggeurts (Gerke Geurts)
- andrewrissing (Andrew Rissing)
- jjavery (James Javery)
- suremaker (Wojtek)
- cheesebaron (Tomasz Cielecki)
- mikkelfish (Mikkel Fishman)
- johngibb (John Gibb)
- stabbylambda (David Stone)
- mikepugh (Mike Pugh)
- permalmberg (Per Malmberg)
- adamralph (Adam Ralph)
- shamsulamry (Shamsul Amry)
- peterlazzarino (Peter Lazzarino)
- kevin-montrose (Kevin Montrose)
- msarchet (Michael Sarchet)
- jeffgabhart (Jeff Gabhart)
- pkudinov (Pavel Kudinov)
- permalmberg (Per Malmberg)
- namman (Nick Miller)
- leon-andria (Leon Andria)
- kkolstad (Kenneth Kolstad)
- electricshaman (Jeff Smith)
- ecgan (Gan Eng Chin)
- its-tyson (Tyson Stolarski)
- tischlda (David Tischler)
- connectassist (Carl Healy)
- starteleport
- jfoshee (Jacob Foshee)
- nardin (Mamaev Michail)
- cliffstill
- somya (Somya Jain)
- thinkbeforecoding (Jérémie Chassaing)
- paksys (Khalil Ahmad)
- mcguinness (Karl McGuinness)
- jpasichnyk (Jesse Pasichnyk)
- waynebrantley (Wayne Brantley)
- dcartoon (Dan Cartoon)
- alexvodovoz (Alex Vodovoz)
- jluchiji (Denis Luchkin-Zhou)
- grexican
- akoslukacs (Ákos Lukács)
- medianick (Nick Jones)
- arhoads76
- dylanvdmerwe (Dylan v.d Merwe)
- mattiasw2 (Mattias)
- paultyng (Paul Tyng)
- h2oman (Jason Waterman)
- anewton (Allen Newton)
- sami1971
- russellchadwick (Russell Chadwick)
- cyberzed (Stefan Daugaard Poulsen)
- filipw (Filip Wojcieszyn)
- ghuntley (Geoffrey Huntley)
- baramuse
- pdegenhardt (Phil Degenhardt)
- captncraig (Craig Peterson)
- abattery (Jae sung Chung)
- biliktamas79
- garuma (Jérémie Laval)
- dsimunic
- adamfowleruk (Adam Fowler)
- bfriesen (Brian Friesen)
- roryf (Rory Fitzpatrick)
- stefandevo
- gdassac
- metal10k
- cmelgarejo
- skaman
- rossipedia (Bryan J. Ross)
- wimatihomer (Wim Pool)
- sword-breaker
- adebisi-fa (Adebisi Foluso A.)
- mbischoff (M. Bischoff)
- ivanfioravanti (Ivan Fioravanti)
- inhibition (Keith Hassen)
- joshearl (Josh Earl)
- friism (Michael Friis)
- corkupine
- bchavez (Brian Chavez)
- nhhagen (Niels Henrik Hagen)
- daggmano (Darren Oster)
- chappoo (Steve Chapman)
- julrichkieffer (Julrich Kieffer)
- adamclarsen (Adam Larsen)
- joero74 (Joerg Rosenkranz)
- ddotlic (Drazen Dotlic)
- chrismcv (Chris McVittie)
- marcioalthmann (Márcio Fábio Althmann)
- mmertsock (Mike Mertsock)
- johnkamau (John Kamau)
- uhaciogullari (Ufuk Hacıoğulları)
- davybrion (Davy Brion)
- aleshi (Alexander Shiryaev)
- alexandryz (Alexandr Zaozerskiy)
- mistobaan (Fabrizio Milo)
- niemyjski (Blake Niemyjski)
- alexandernyquist (Alexander Nyquist)
- mcduck76
- kojoru
- jeremy-bridges (Jeremy Bridges)
- andreabalducci (Andrea Balducci)
- robertthegrey (Robert Greyling)
- robertbeal (Robert Beal)
- improvedk (Mark Rasmussen)
- foresterh (Jamie Houston)
- peterkahl (Peter Kahl)
- helgel
- anthonycarl (Anthony Carl)
- mrjul (Julien Lebosquain)
- pwhe23 (Paul Wheeler)
- aleksd
- miketrebilcock (Mike Trebilcock)
- markwoodhall (Mark Woodhall)
- theonlylawislove (Paul Knopf)
- callumvass (Callum Vass)
- bpruitt-goddard
- gregpakes (Greg Pakes)
- caspiancanuck (Caspian Canuck)
- merwer
- pavelsavara (Pavel Savara)
- markwalls (Mark Walls)
- prasannavl (Prasanna Loganathar)
- wilfrem
- emiba
- lucky-ly (Dmitry Svechnikov)
- hhandoko (Herdy Handoko)
- datawingsoftware
- tal952
- bretternst
- kevinhoward (Kevin Howard)
- mattbutton (Matt Button)
- torbenrahbekkoch (Torben Rahbek Koch)
- pilotmartin (Pilot Martin)
- catlion
- tstade (Toft Stade)
- niltz (Jeff Sawatzky)
- nhalm
- fhurta (Filip Hurta)
- discobanan
- x-cray
- jeremistadler (Jeremi Stadler)
- bangbite
- felipesabino (Felipe Sabino)
- xelom (Arıl Bozoluk)
- shiweichuan (Weichuan Shi)
- kojoru (Konstantin Yakushev)
- eddiegroves (Eddie Groves)
- fetters5
- rcollette (Richard Collette)
- urihendler (Uri Hendler)
- laurencee (Laurence Evans)
- m-andrew-albright (Andrew Albright)
- lee337 (Lee Venkatsamy)
- kaza
- mishfit
- rfvgyhn (Chris)
- caioproiete (Caio Proiete)
- sjuxax (Jeff Cook)
- madaleno (Luis Madaleno)
- yavosh (Yavor Shahpasov)
- fvoncina (Facundo Voncina)
- devrios (Dev Rios)
- bfkelsey (Ben Kelsey)
- maksimenko
- dixon (Jarrod Dixon)
- kal (Kal Ahmed)
- mhanney (Michael Hanney)
- bcms
- mgravell (Marc Gravell)
- lafama (Denis Ndwiga)
- jamesgroat (James Groat)
- jamesearl (James Cunningham)
- remkoboschker (Remko Boschker)
- shelakel
- schmidt4brains (Doug Schmidt)
- joplaal
- aifdsc (Stephan Desmoulin)
- nicklarsen (NickLarsen)
- connectassist (Carl Healy)
- et1975 (Eugene Tolmachev)
- barambani
- nhalm
Similar Open source .NET projects for developing or accessing web services include:
- Nancy Fx - A Sinatra-inspired lightweight Web Framework for .NET:
- Fubu MVC - A "Front Controller" pattern-style MVC framework designed for use in web applications built on ASP.NET:
- Rest Sharp - An open source REST client for .NET